mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-19 13:00:28 +00:00
port pthread_mutex_t and pthread_cond_t from sys/unix cause miniaudio wants it
This commit is contained in:
@@ -399,6 +399,16 @@ when ODIN_OS == .Darwin {
|
||||
|
||||
pthread_key_t :: distinct c.ulong
|
||||
|
||||
pthread_mutex_t :: struct {
|
||||
__sig: c.long,
|
||||
__opaque: [56]c.char,
|
||||
}
|
||||
|
||||
pthread_cond_t :: struct {
|
||||
__sig: c.long,
|
||||
__opaque: [40]c.char,
|
||||
}
|
||||
|
||||
sched_param :: struct {
|
||||
sched_priority: c.int, /* [PSX] process or thread execution scheduling priority */
|
||||
_: [4]c.char,
|
||||
@@ -432,10 +442,20 @@ when ODIN_OS == .Darwin {
|
||||
|
||||
pthread_t :: distinct u64
|
||||
|
||||
pthread_attr_t :: distinct rawptr
|
||||
pthread_attr_t :: struct #align(16) {
|
||||
_: [8]byte,
|
||||
}
|
||||
|
||||
pthread_key_t :: distinct c.int
|
||||
|
||||
pthread_mutex_t :: struct #align(16) {
|
||||
_: [8]byte,
|
||||
}
|
||||
|
||||
pthread_cond_t :: struct #align(16) {
|
||||
_: [8]byte,
|
||||
}
|
||||
|
||||
sched_param :: struct {
|
||||
sched_priority: c.int, /* [PSX] process or thread execution scheduling priority */
|
||||
}
|
||||
@@ -476,6 +496,14 @@ when ODIN_OS == .Darwin {
|
||||
|
||||
pthread_key_t :: distinct c.int
|
||||
|
||||
pthread_cond_t :: struct #align(8) {
|
||||
_: [40]byte,
|
||||
}
|
||||
|
||||
pthread_mutex_t :: struct #align(8) {
|
||||
_: [48]byte,
|
||||
}
|
||||
|
||||
sched_param :: struct {
|
||||
sched_priority: c.int, /* [PSX] process or thread execution scheduling priority */
|
||||
}
|
||||
@@ -506,9 +534,11 @@ when ODIN_OS == .Darwin {
|
||||
PTHREAD_SCOPE_PROCESS :: 0
|
||||
PTHREAD_SCOPE_SYSTEM :: 0x2
|
||||
|
||||
pthread_t :: distinct rawptr
|
||||
pthread_attr_t :: distinct rawptr
|
||||
pthread_key_t :: distinct c.int
|
||||
pthread_t :: distinct rawptr
|
||||
pthread_attr_t :: distinct rawptr
|
||||
pthread_key_t :: distinct c.int
|
||||
pthread_mutex_t :: distinct rawptr
|
||||
pthread_cond_t :: distinct rawptr
|
||||
|
||||
sched_param :: struct {
|
||||
sched_priority: c.int, /* [PSX] process or thread execution scheduling priority */
|
||||
@@ -549,6 +579,16 @@ when ODIN_OS == .Darwin {
|
||||
|
||||
pthread_key_t :: distinct c.uint
|
||||
|
||||
pthread_cond_t :: struct {
|
||||
__size: [40]c.char, // NOTE: may be smaller depending on libc or arch, but never larger.
|
||||
__align: c.long,
|
||||
}
|
||||
|
||||
pthread_mutex_t :: struct {
|
||||
__size: [32]c.char, // NOTE: may be smaller depending on libc or arch, but never larger.
|
||||
__align: c.long,
|
||||
}
|
||||
|
||||
sched_param :: struct {
|
||||
sched_priority: c.int, /* [PSX] process or thread execution scheduling priority */
|
||||
|
||||
|
||||
14
vendor/miniaudio/common_unix.odin
vendored
14
vendor/miniaudio/common_unix.odin
vendored
@@ -1,18 +1,18 @@
|
||||
#+build !windows
|
||||
package miniaudio
|
||||
|
||||
import "core:sys/unix"
|
||||
import "core:sys/posix"
|
||||
import "core:c"
|
||||
|
||||
thread :: unix.pthread_t
|
||||
mutex :: unix.pthread_mutex_t
|
||||
thread :: posix.pthread_t
|
||||
mutex :: posix.pthread_mutex_t
|
||||
event :: struct {
|
||||
value: u32,
|
||||
lock: unix.pthread_mutex_t,
|
||||
cond: unix.pthread_cond_t,
|
||||
lock: posix.pthread_mutex_t,
|
||||
cond: posix.pthread_cond_t,
|
||||
}
|
||||
semaphore :: struct {
|
||||
value: c.int,
|
||||
lock: unix.pthread_mutex_t,
|
||||
cond: unix.pthread_cond_t,
|
||||
lock: posix.pthread_mutex_t,
|
||||
cond: posix.pthread_cond_t,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user