diff options
| author | gingerBill <bill@gingerbill.org> | 2021-09-08 13:12:38 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-09-08 13:12:38 +0100 |
| commit | ca33cb990b5a05829067e18ea24bcb36a75aba67 (patch) | |
| tree | c3fa66a18cee6f44ea409e62e3878295f881c49a /core/sys | |
| parent | d4f5ef046da7d1d3402f671e84fa483c71a3b26f (diff) | |
Strip semicolons in core which were missing
Diffstat (limited to 'core/sys')
| -rw-r--r-- | core/sys/darwin/mach_darwin.odin | 24 | ||||
| -rw-r--r-- | core/sys/unix/pthread_darwin.odin | 68 | ||||
| -rw-r--r-- | core/sys/unix/pthread_linux.odin | 90 | ||||
| -rw-r--r-- | core/sys/unix/pthread_unix.odin | 78 |
4 files changed, 130 insertions, 130 deletions
diff --git a/core/sys/darwin/mach_darwin.odin b/core/sys/darwin/mach_darwin.odin index 25fc63c32..e6272b9aa 100644 --- a/core/sys/darwin/mach_darwin.odin +++ b/core/sys/darwin/mach_darwin.odin @@ -1,4 +1,4 @@ -package darwin; +package darwin foreign import pthread "System.framework" @@ -8,22 +8,22 @@ import "core:c" // 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; +task_t :: distinct u64 +semaphore_t :: distinct u64 -kern_return_t :: distinct u64; -thread_act_t :: distinct u64; +kern_return_t :: distinct u64 +thread_act_t :: distinct u64 @(default_calling_convention="c") foreign pthread { - mach_task_self :: proc() -> task_t ---; + mach_task_self :: proc() -> task_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_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_signal :: 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 :: 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_wait :: proc(semaphore: semaphore_t) -> kern_return_t ---; + semaphore_wait :: proc(semaphore: semaphore_t) -> kern_return_t --- } diff --git a/core/sys/unix/pthread_darwin.odin b/core/sys/unix/pthread_darwin.odin index a958e0b84..1ff6f44bb 100644 --- a/core/sys/unix/pthread_darwin.odin +++ b/core/sys/unix/pthread_darwin.odin @@ -1,82 +1,82 @@ -package unix; +package unix import "core:c" // NOTE(tetra): No 32-bit Macs. // Source: _pthread_types.h on my Mac. -PTHREAD_SIZE :: 8176; -PTHREAD_ATTR_SIZE :: 56; -PTHREAD_MUTEXATTR_SIZE :: 8; -PTHREAD_MUTEX_SIZE :: 56; -PTHREAD_CONDATTR_SIZE :: 8; -PTHREAD_COND_SIZE :: 40; -PTHREAD_ONCE_SIZE :: 8; -PTHREAD_RWLOCK_SIZE :: 192; -PTHREAD_RWLOCKATTR_SIZE :: 16; - -pthread_t :: distinct u64; +PTHREAD_SIZE :: 8176 +PTHREAD_ATTR_SIZE :: 56 +PTHREAD_MUTEXATTR_SIZE :: 8 +PTHREAD_MUTEX_SIZE :: 56 +PTHREAD_CONDATTR_SIZE :: 8 +PTHREAD_COND_SIZE :: 40 +PTHREAD_ONCE_SIZE :: 8 +PTHREAD_RWLOCK_SIZE :: 192 +PTHREAD_RWLOCKATTR_SIZE :: 16 + +pthread_t :: distinct u64 pthread_attr_t :: struct #align 16 { sig: c.long, _: [PTHREAD_ATTR_SIZE] c.char, -}; +} pthread_cond_t :: struct #align 16 { sig: c.long, _: [PTHREAD_COND_SIZE] c.char, -}; +} pthread_condattr_t :: struct #align 16 { sig: c.long, _: [PTHREAD_CONDATTR_SIZE] c.char, -}; +} pthread_mutex_t :: struct #align 16 { sig: c.long, _: [PTHREAD_MUTEX_SIZE] c.char, -}; +} pthread_mutexattr_t :: struct #align 16 { sig: c.long, _: [PTHREAD_MUTEXATTR_SIZE] c.char, -}; +} pthread_once_t :: struct #align 16 { sig: c.long, _: [PTHREAD_ONCE_SIZE] c.char, -}; +} pthread_rwlock_t :: struct #align 16 { sig: c.long, _: [PTHREAD_RWLOCK_SIZE] c.char, -}; +} pthread_rwlockattr_t :: struct #align 16 { sig: c.long, _: [PTHREAD_RWLOCKATTR_SIZE] c.char, -}; +} -SCHED_OTHER :: 1; // Avoid if you are writing portable software. -SCHED_FIFO :: 4; -SCHED_RR :: 2; // Round robin. +SCHED_OTHER :: 1 // Avoid if you are writing portable software. +SCHED_FIFO :: 4 +SCHED_RR :: 2 // Round robin. -SCHED_PARAM_SIZE :: 4; +SCHED_PARAM_SIZE :: 4 sched_param :: struct { sched_priority: c.int, _: [SCHED_PARAM_SIZE] c.char, -}; +} // Source: https://github.com/apple/darwin-libpthread/blob/03c4628c8940cca6fd6a82957f683af804f62e7f/pthread/pthread.h#L138 -PTHREAD_CREATE_JOINABLE :: 1; -PTHREAD_CREATE_DETACHED :: 2; -PTHREAD_INHERIT_SCHED :: 1; -PTHREAD_EXPLICIT_SCHED :: 2; -PTHREAD_PROCESS_SHARED :: 1; -PTHREAD_PROCESS_PRIVATE :: 2; +PTHREAD_CREATE_JOINABLE :: 1 +PTHREAD_CREATE_DETACHED :: 2 +PTHREAD_INHERIT_SCHED :: 1 +PTHREAD_EXPLICIT_SCHED :: 2 +PTHREAD_PROCESS_SHARED :: 1 +PTHREAD_PROCESS_PRIVATE :: 2 -PTHREAD_MUTEX_NORMAL :: 0; -PTHREAD_MUTEX_RECURSIVE :: 1; -PTHREAD_MUTEX_ERRORCHECK :: 2; +PTHREAD_MUTEX_NORMAL :: 0 +PTHREAD_MUTEX_RECURSIVE :: 1 +PTHREAD_MUTEX_ERRORCHECK :: 2 diff --git a/core/sys/unix/pthread_linux.odin b/core/sys/unix/pthread_linux.odin index 25d828d81..15164c9f3 100644 --- a/core/sys/unix/pthread_linux.odin +++ b/core/sys/unix/pthread_linux.odin @@ -1,4 +1,4 @@ -package unix; +package unix import "core:c" @@ -6,78 +6,78 @@ import "core:c" // I cannot currently do this. // And at the time of writing there is a bug with putting it // as the only field in a struct. -pthread_t :: distinct u64; +pthread_t :: distinct u64 // pthread_t :: struct #align 16 { x: u64 }; // NOTE(tetra): Got all the size constants from pthreadtypes-arch.h on my // Linux machine. -PTHREAD_COND_T_SIZE :: 48; +PTHREAD_COND_T_SIZE :: 48 -PTHREAD_MUTEXATTR_T_SIZE :: 4; -PTHREAD_CONDATTR_T_SIZE :: 4; -PTHREAD_RWLOCKATTR_T_SIZE :: 8; -PTHREAD_BARRIERATTR_T_SIZE :: 4; +PTHREAD_MUTEXATTR_T_SIZE :: 4 +PTHREAD_CONDATTR_T_SIZE :: 4 +PTHREAD_RWLOCKATTR_T_SIZE :: 8 +PTHREAD_BARRIERATTR_T_SIZE :: 4 // WARNING: The sizes of these things are different yet again // on non-X86! when size_of(int) == 8 { - PTHREAD_ATTR_T_SIZE :: 56; - PTHREAD_MUTEX_T_SIZE :: 40; - PTHREAD_RWLOCK_T_SIZE :: 56; - PTHREAD_BARRIER_T_SIZE :: 32; + PTHREAD_ATTR_T_SIZE :: 56 + PTHREAD_MUTEX_T_SIZE :: 40 + PTHREAD_RWLOCK_T_SIZE :: 56 + PTHREAD_BARRIER_T_SIZE :: 32 } else when size_of(int) == 4 { - PTHREAD_ATTR_T_SIZE :: 32; - PTHREAD_MUTEX_T_SIZE :: 32; - PTHREAD_RWLOCK_T_SIZE :: 44; - PTHREAD_BARRIER_T_SIZE :: 20; + PTHREAD_ATTR_T_SIZE :: 32 + PTHREAD_MUTEX_T_SIZE :: 32 + PTHREAD_RWLOCK_T_SIZE :: 44 + PTHREAD_BARRIER_T_SIZE :: 20 } pthread_cond_t :: struct #align 16 { _: [PTHREAD_COND_T_SIZE] c.char, -}; +} pthread_mutex_t :: struct #align 16 { _: [PTHREAD_MUTEX_T_SIZE] c.char, -}; +} pthread_rwlock_t :: struct #align 16 { _: [PTHREAD_RWLOCK_T_SIZE] c.char, -}; +} pthread_barrier_t :: struct #align 16 { _: [PTHREAD_BARRIER_T_SIZE] c.char, -}; +} pthread_attr_t :: struct #align 16 { _: [PTHREAD_ATTR_T_SIZE] c.char, -}; +} pthread_condattr_t :: struct #align 16 { _: [PTHREAD_CONDATTR_T_SIZE] c.char, -}; +} pthread_mutexattr_t :: struct #align 16 { _: [PTHREAD_MUTEXATTR_T_SIZE] c.char, -}; +} pthread_rwlockattr_t :: struct #align 16 { _: [PTHREAD_RWLOCKATTR_T_SIZE] c.char, -}; +} pthread_barrierattr_t :: struct #align 16 { _: [PTHREAD_BARRIERATTR_T_SIZE] c.char, -}; +} -PTHREAD_MUTEX_NORMAL :: 0; -PTHREAD_MUTEX_RECURSIVE :: 1; -PTHREAD_MUTEX_ERRORCHECK :: 2; +PTHREAD_MUTEX_NORMAL :: 0 +PTHREAD_MUTEX_RECURSIVE :: 1 +PTHREAD_MUTEX_ERRORCHECK :: 2 // TODO(tetra, 2019-11-01): Maybe make `enum c.int`s for these? -PTHREAD_CREATE_JOINABLE :: 0; -PTHREAD_CREATE_DETACHED :: 1; -PTHREAD_INHERIT_SCHED :: 0; -PTHREAD_EXPLICIT_SCHED :: 1; -PTHREAD_PROCESS_PRIVATE :: 0; -PTHREAD_PROCESS_SHARED :: 1; +PTHREAD_CREATE_JOINABLE :: 0 +PTHREAD_CREATE_DETACHED :: 1 +PTHREAD_INHERIT_SCHED :: 0 +PTHREAD_EXPLICIT_SCHED :: 1 +PTHREAD_PROCESS_PRIVATE :: 0 +PTHREAD_PROCESS_SHARED :: 1 -SCHED_OTHER :: 0; -SCHED_FIFO :: 1; -SCHED_RR :: 2; // Round robin. +SCHED_OTHER :: 0 +SCHED_FIFO :: 1 +SCHED_RR :: 2 // Round robin. sched_param :: struct { sched_priority: c.int, @@ -88,9 +88,9 @@ sem_t :: struct #align 16 { } when size_of(int) == 8 { - SEM_T_SIZE :: 32; + SEM_T_SIZE :: 32 } else when size_of(int) == 4 { - SEM_T_SIZE :: 16; + SEM_T_SIZE :: 16 } foreign import "system:pthread" @@ -99,16 +99,16 @@ foreign import "system:pthread" foreign pthread { // create named semaphore. // used in process-shared semaphores. - sem_open :: proc(name: cstring, flags: c.int) -> ^sem_t ---; + sem_open :: proc(name: cstring, flags: c.int) -> ^sem_t --- - sem_init :: proc(sem: ^sem_t, pshared: c.int, initial_value: c.uint) -> c.int ---; - sem_destroy :: proc(sem: ^sem_t) -> c.int ---; - sem_post :: proc(sem: ^sem_t) -> c.int ---; - sem_wait :: proc(sem: ^sem_t) -> c.int ---; - sem_trywait :: proc(sem: ^sem_t) -> c.int ---; + sem_init :: proc(sem: ^sem_t, pshared: c.int, initial_value: c.uint) -> c.int --- + sem_destroy :: proc(sem: ^sem_t) -> c.int --- + sem_post :: proc(sem: ^sem_t) -> c.int --- + sem_wait :: proc(sem: ^sem_t) -> c.int --- + sem_trywait :: proc(sem: ^sem_t) -> c.int --- // sem_timedwait :: proc(sem: ^sem_t, timeout: time.TimeSpec) -> c.int ---; // NOTE: unclear whether pthread_yield is well-supported on Linux systems, // see https://linux.die.net/man/3/pthread_yield - pthread_yield :: proc() -> c.int ---; + pthread_yield :: proc() -> c.int --- } diff --git a/core/sys/unix/pthread_unix.odin b/core/sys/unix/pthread_unix.odin index a8a680bce..f514d9d3d 100644 --- a/core/sys/unix/pthread_unix.odin +++ b/core/sys/unix/pthread_unix.odin @@ -1,4 +1,4 @@ -package unix; +package unix foreign import "system:pthread" @@ -11,34 +11,34 @@ import "core:time" @(default_calling_convention="c") foreign pthread { - pthread_create :: proc(t: ^pthread_t, attrs: ^pthread_attr_t, routine: proc(data: rawptr) -> rawptr, arg: rawptr) -> c.int ---; + pthread_create :: proc(t: ^pthread_t, attrs: ^pthread_attr_t, routine: proc(data: rawptr) -> rawptr, arg: rawptr) -> c.int --- // retval is a pointer to a location to put the return value of the thread proc. - pthread_join :: proc(t: pthread_t, retval: ^rawptr) -> c.int ---; + pthread_join :: proc(t: pthread_t, retval: ^rawptr) -> c.int --- - pthread_self :: proc() -> pthread_t ---; + pthread_self :: proc() -> pthread_t --- - pthread_equal :: proc(a, b: pthread_t) -> b32 ---; + pthread_equal :: proc(a, b: pthread_t) -> b32 --- - sched_get_priority_min :: proc(policy: c.int) -> c.int ---; - sched_get_priority_max :: proc(policy: c.int) -> c.int ---; + sched_get_priority_min :: proc(policy: c.int) -> c.int --- + sched_get_priority_max :: proc(policy: c.int) -> c.int --- // NOTE: POSIX says this can fail with OOM. - pthread_attr_init :: proc(attrs: ^pthread_attr_t) -> c.int ---; + pthread_attr_init :: proc(attrs: ^pthread_attr_t) -> c.int --- - pthread_attr_destroy :: proc(attrs: ^pthread_attr_t) -> c.int ---; + pthread_attr_destroy :: proc(attrs: ^pthread_attr_t) -> c.int --- - pthread_attr_getschedparam :: proc(attrs: ^pthread_attr_t, param: ^sched_param) -> c.int ---; - pthread_attr_setschedparam :: proc(attrs: ^pthread_attr_t, param: ^sched_param) -> c.int ---; + pthread_attr_getschedparam :: proc(attrs: ^pthread_attr_t, param: ^sched_param) -> c.int --- + pthread_attr_setschedparam :: proc(attrs: ^pthread_attr_t, param: ^sched_param) -> c.int --- - pthread_attr_getschedpolicy :: proc(t: ^pthread_attr_t, policy: ^c.int) -> c.int ---; - pthread_attr_setschedpolicy :: proc(t: ^pthread_attr_t, policy: c.int) -> c.int ---; + pthread_attr_getschedpolicy :: proc(t: ^pthread_attr_t, policy: ^c.int) -> c.int --- + pthread_attr_setschedpolicy :: proc(t: ^pthread_attr_t, policy: c.int) -> c.int --- // states: PTHREAD_CREATE_DETACHED, PTHREAD_CREATE_JOINABLE - pthread_attr_setdetachstate :: proc(attrs: ^pthread_attr_t, detach_state: c.int) -> c.int ---; + pthread_attr_setdetachstate :: proc(attrs: ^pthread_attr_t, detach_state: c.int) -> c.int --- // scheds: PTHREAD_INHERIT_SCHED, PTHREAD_EXPLICIT_SCHED - pthread_attr_setinheritsched :: proc(attrs: ^pthread_attr_t, sched: c.int) -> c.int ---; + pthread_attr_setinheritsched :: proc(attrs: ^pthread_attr_t, sched: c.int) -> c.int --- // NOTE(tetra, 2019-11-06): WARNING: Different systems have different alignment requirements. // For maximum usefulness, use the OS's page size. @@ -49,63 +49,63 @@ foreign pthread { // guard pages. If you are using this procedure, YOU must set them up manually. // If you forget to do this, you WILL get stack corruption bugs if you do not EXTREMELY // know what you are doing! - pthread_attr_setstack :: proc(attrs: ^pthread_attr_t, stack_ptr: rawptr, stack_size: u64) -> c.int ---; - pthread_attr_getstack :: proc(attrs: ^pthread_attr_t, stack_ptr: ^rawptr, stack_size: ^u64) -> c.int ---; + pthread_attr_setstack :: proc(attrs: ^pthread_attr_t, stack_ptr: rawptr, stack_size: u64) -> c.int --- + pthread_attr_getstack :: proc(attrs: ^pthread_attr_t, stack_ptr: ^rawptr, stack_size: ^u64) -> c.int --- - sched_yield :: proc() -> c.int ---; + sched_yield :: proc() -> c.int --- } @(default_calling_convention="c") foreign pthread { // NOTE: POSIX says this can fail with OOM. - pthread_cond_init :: proc(cond: ^pthread_cond_t, attrs: ^pthread_condattr_t) -> c.int ---; + pthread_cond_init :: proc(cond: ^pthread_cond_t, attrs: ^pthread_condattr_t) -> c.int --- - pthread_cond_destroy :: proc(cond: ^pthread_cond_t) -> c.int ---; + pthread_cond_destroy :: proc(cond: ^pthread_cond_t) -> c.int --- - pthread_cond_signal :: proc(cond: ^pthread_cond_t) -> c.int ---; + pthread_cond_signal :: proc(cond: ^pthread_cond_t) -> c.int --- // same as signal, but wakes up _all_ threads that are waiting - pthread_cond_broadcast :: proc(cond: ^pthread_cond_t) -> c.int ---; + pthread_cond_broadcast :: proc(cond: ^pthread_cond_t) -> c.int --- // assumes the mutex is pre-locked - pthread_cond_wait :: proc(cond: ^pthread_cond_t, mutex: ^pthread_mutex_t) -> c.int ---; - pthread_cond_timedwait :: proc(cond: ^pthread_cond_t, mutex: ^pthread_mutex_t, timeout: ^time.TimeSpec) -> c.int ---; + pthread_cond_wait :: proc(cond: ^pthread_cond_t, mutex: ^pthread_mutex_t) -> c.int --- + pthread_cond_timedwait :: proc(cond: ^pthread_cond_t, mutex: ^pthread_mutex_t, timeout: ^time.TimeSpec) -> c.int --- - pthread_condattr_init :: proc(attrs: ^pthread_condattr_t) -> c.int ---; - pthread_condattr_destroy :: proc(attrs: ^pthread_condattr_t) -> c.int ---; + pthread_condattr_init :: proc(attrs: ^pthread_condattr_t) -> c.int --- + pthread_condattr_destroy :: proc(attrs: ^pthread_condattr_t) -> c.int --- // p-shared = "process-shared" - i.e: is this condition shared among multiple processes? // values: PTHREAD_PROCESS_PRIVATE, PTHREAD_PROCESS_SHARED - pthread_condattr_setpshared :: proc(attrs: ^pthread_condattr_t, value: c.int) -> c.int ---; - pthread_condattr_getpshared :: proc(attrs: ^pthread_condattr_t, result: ^c.int) -> c.int ---; + pthread_condattr_setpshared :: proc(attrs: ^pthread_condattr_t, value: c.int) -> c.int --- + pthread_condattr_getpshared :: proc(attrs: ^pthread_condattr_t, result: ^c.int) -> c.int --- } @(default_calling_convention="c") foreign pthread { // NOTE: POSIX says this can fail with OOM. - pthread_mutex_init :: proc(mutex: ^pthread_mutex_t, attrs: ^pthread_mutexattr_t) -> c.int ---; + pthread_mutex_init :: proc(mutex: ^pthread_mutex_t, attrs: ^pthread_mutexattr_t) -> c.int --- - pthread_mutex_destroy :: proc(mutex: ^pthread_mutex_t) -> c.int ---; + pthread_mutex_destroy :: proc(mutex: ^pthread_mutex_t) -> c.int --- - pthread_mutex_trylock :: proc(mutex: ^pthread_mutex_t) -> c.int ---; + pthread_mutex_trylock :: proc(mutex: ^pthread_mutex_t) -> c.int --- - pthread_mutex_lock :: proc(mutex: ^pthread_mutex_t) -> c.int ---; + pthread_mutex_lock :: proc(mutex: ^pthread_mutex_t) -> c.int --- - pthread_mutex_timedlock :: proc(mutex: ^pthread_mutex_t, timeout: ^time.TimeSpec) -> c.int ---; + pthread_mutex_timedlock :: proc(mutex: ^pthread_mutex_t, timeout: ^time.TimeSpec) -> c.int --- - pthread_mutex_unlock :: proc(mutex: ^pthread_mutex_t) -> c.int ---; + pthread_mutex_unlock :: proc(mutex: ^pthread_mutex_t) -> c.int --- - pthread_mutexattr_init :: proc(attrs: ^pthread_mutexattr_t) -> c.int ---; - pthread_mutexattr_destroy :: proc(attrs: ^pthread_mutexattr_t) -> c.int ---; - pthread_mutexattr_settype :: proc(attrs: ^pthread_mutexattr_t, type: c.int) -> c.int ---; + pthread_mutexattr_init :: proc(attrs: ^pthread_mutexattr_t) -> c.int --- + pthread_mutexattr_destroy :: proc(attrs: ^pthread_mutexattr_t) -> c.int --- + pthread_mutexattr_settype :: proc(attrs: ^pthread_mutexattr_t, type: c.int) -> c.int --- // p-shared = "process-shared" - i.e: is this mutex shared among multiple processes? // values: PTHREAD_PROCESS_PRIVATE, PTHREAD_PROCESS_SHARED - pthread_mutexattr_setpshared :: proc(attrs: ^pthread_mutexattr_t, value: c.int) -> c.int ---; - pthread_mutexattr_getpshared :: proc(attrs: ^pthread_mutexattr_t, result: ^c.int) -> c.int ---; + pthread_mutexattr_setpshared :: proc(attrs: ^pthread_mutexattr_t, value: c.int) -> c.int --- + pthread_mutexattr_getpshared :: proc(attrs: ^pthread_mutexattr_t, result: ^c.int) -> c.int --- } |