-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from DoumanAsh/semka
- Loading branch information
Showing
5 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//! This module corresponds to `mach/semaphore.h` | ||
use clock_types::mach_timespec_t; | ||
use kern_return::kern_return_t; | ||
use mach_types::{semaphore_t, task_t}; | ||
use sync_policy::sync_policy_t; | ||
|
||
extern "C" { | ||
pub fn semaphore_create( | ||
task: task_t, | ||
semaphore: *mut semaphore_t, | ||
policy: sync_policy_t, | ||
value: libc::c_int, | ||
) -> kern_return_t; | ||
pub fn semaphore_signal(semaphore: *mut semaphore_t) -> kern_return_t; | ||
pub fn semaphore_wait(semaphore: *mut semaphore_t) -> kern_return_t; | ||
pub fn semaphore_timedwait( | ||
semaphore: *mut semaphore_t, | ||
timeout: mach_timespec_t, | ||
) -> kern_return_t; | ||
pub fn semaphore_destroy(task: task_t, semaphore: *mut semaphore_t) -> kern_return_t; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//! This module corresponds to `mach/sync_policy.h` | ||
pub type sync_policy_t = libc::c_int; | ||
|
||
pub const SYNC_POLICY_FIFO: sync_policy_t = 0x0; | ||
pub const SYNC_POLICY_FIXED_PRIORITY: sync_policy_t = 0x1; | ||
pub const SYNC_POLICY_REVERSED: sync_policy_t = 0x2; | ||
pub const SYNC_POLICY_ORDER_MASK: sync_policy_t = 0x3; | ||
pub const SYNC_POLICY_LIFO: sync_policy_t = SYNC_POLICY_FIFO | SYNC_POLICY_REVERSED; |