JohnTitor / mach2

Apache License 2.0
32 stars 12 forks source link

Semaphore API availability? #11

Closed DoumanAsh closed 8 months ago

DoumanAsh commented 2 years ago

crate contains some semaphore definitions and types, but doesn't expose API Is there particular reason?

I use these functions myself, wondering if it would be ok to add it to this crate?

extern "C" {
    static mach_task_self_: libc::c_uint;

    //typedef struct semaphore *semaphore_t;
    //Function takes semaphore_t*
    fn semaphore_create(task: libc::c_uint, semaphore: *mut *mut c_void, policy: libc::c_int, value: libc::c_int) -> libc::c_int;
    fn semaphore_signal(semaphore: *mut c_void) -> libc::c_int;
    fn semaphore_wait(semaphore: *mut c_void) -> libc::c_int;
    fn semaphore_timedwait(semaphore: *mut c_void, timeout: TimeSpec) -> libc::c_int;
    fn semaphore_destroy(task: libc::c_uint, semaphore: *mut c_void) -> libc::c_int;
}
JohnTitor commented 2 years ago

They just don't exist here, there's no reason. I'm happy to see a PR!