3 semacquire, tsemacquire, semrelease - user level semaphores
10 int semacquire(long *addr, int block);
13 int tsemacquire(long *addr, ulong ms);
16 long semrelease(long *addr, long count);
22 facilitate scheduling between processes sharing memory.
23 Processes arrange to share memory by using
34 The semaphore's value is the integer pointed at by
37 atomically waits until the semaphore has a positive value
38 and then decrements that value.
42 and the semaphore is not immediately available,
44 returns 0 instead of waiting.
48 milliseconds for the semaphore to attain a positive value
49 and, if available in that time, decrements that value.
50 It returns 0 otherwise.
51 Both functions return 1 if the semaphore was acquired
53 (e.g., if they were interrupted).
57 to the semaphore's value
58 and returns the new value.
65 can be thought of as efficient, correct replacements for:
69 semacquire(long *addr, int block)
82 semrelease(long *addr, int count)
84 return *addr += count;
94 are not typically used directly.
95 Instead, they are intended to be used to coordinate
96 scheduling in higher-level abstractions such as
97 locks, rendezvous points, and channels
108 cannot be used to coordinate between threads
110 Use locks, rendezvous points, or channels instead.
112 .B /sys/src/9/port/sysproc.c