|
@@ -4,20 +4,15 @@ foreign import mach "system:System.framework"
|
|
|
|
|
|
import "core:c"
|
|
import "core:c"
|
|
|
|
|
|
-// NOTE(tetra): Unclear whether these should be aligned 16 or not.
|
|
|
|
-// However all other sync primitives are aligned for robustness.
|
|
|
|
-// I cannot currently align these though.
|
|
|
|
-// See core/sys/unix/pthread_linux.odin/pthread_t.
|
|
|
|
-task_t :: distinct u64
|
|
|
|
-semaphore_t :: distinct u64
|
|
|
|
-
|
|
|
|
-kern_return_t :: distinct u64
|
|
|
|
-thread_act_t :: distinct u64
|
|
|
|
|
|
+kern_return_t :: distinct c.int
|
|
|
|
|
|
mach_port_t :: distinct c.uint
|
|
mach_port_t :: distinct c.uint
|
|
vm_map_t :: mach_port_t
|
|
vm_map_t :: mach_port_t
|
|
mem_entry_name_port_t :: mach_port_t
|
|
mem_entry_name_port_t :: mach_port_t
|
|
ipc_space_t :: mach_port_t
|
|
ipc_space_t :: mach_port_t
|
|
|
|
+thread_t :: mach_port_t
|
|
|
|
+task_t :: mach_port_t
|
|
|
|
+semaphore_t :: mach_port_t
|
|
|
|
|
|
vm_size_t :: distinct c.uintptr_t
|
|
vm_size_t :: distinct c.uintptr_t
|
|
|
|
|
|
@@ -34,14 +29,14 @@ mach_port_name_t :: distinct c.uint
|
|
|
|
|
|
@(default_calling_convention="c")
|
|
@(default_calling_convention="c")
|
|
foreign mach {
|
|
foreign mach {
|
|
- mach_task_self :: proc() -> task_t ---
|
|
|
|
|
|
+ mach_task_self :: proc() -> mach_port_t ---
|
|
|
|
|
|
semaphore_create :: proc(task: task_t, semaphore: ^semaphore_t, policy, value: c.int) -> kern_return_t ---
|
|
semaphore_create :: proc(task: task_t, semaphore: ^semaphore_t, policy, value: c.int) -> kern_return_t ---
|
|
semaphore_destroy :: proc(task: task_t, semaphore: semaphore_t) -> kern_return_t ---
|
|
semaphore_destroy :: proc(task: task_t, semaphore: semaphore_t) -> kern_return_t ---
|
|
|
|
|
|
semaphore_signal :: proc(semaphore: semaphore_t) -> kern_return_t ---
|
|
semaphore_signal :: proc(semaphore: semaphore_t) -> kern_return_t ---
|
|
semaphore_signal_all :: proc(semaphore: semaphore_t) -> kern_return_t ---
|
|
semaphore_signal_all :: proc(semaphore: semaphore_t) -> kern_return_t ---
|
|
- semaphore_signal_thread :: proc(semaphore: semaphore_t, thread: thread_act_t) -> kern_return_t ---
|
|
|
|
|
|
+ semaphore_signal_thread :: proc(semaphore: semaphore_t, thread: thread_t) -> kern_return_t ---
|
|
|
|
|
|
semaphore_wait :: proc(semaphore: semaphore_t) -> kern_return_t ---
|
|
semaphore_wait :: proc(semaphore: semaphore_t) -> kern_return_t ---
|
|
|
|
|