Thread synchronization
syscalls_mutexCreate
GETFROMSTACK(ustack, unsigned int *, h, 0);
Creates mutex and returns resource handle h
.
syscalls_mutexLock
(syscalls_phMutexLock
)
GETFROMSTACK(ustack, unsigned int, h, 0);
Locks mutex given by handle h
.
syscalls_mutexTry
GETFROMSTACK(ustack, unsigned int, h, 0);
Tries to lock mutex given by handle h
.
syscalls_mutexUnlock
GETFROMSTACK(ustack, unsigned int, h, 0);
Unlocks mutex given by h
.
syscalls_condCreate
GETFROMSTACK(ustack, unsigned int *, h, 0);
Creates conditional variable and returns its handle in variable h
.
syscalls_condWait
(syscalls_phCondWait
)
GETFROMSTACK(ustack, unsigned int, h, 0);
GETFROMSTACK(ustack, unsigned int, m, 1);
GETFROMSTACK(ustack, time_t, timeout, 2);
Waits on conditional given by 'h' for number of microseconds given by timeout
. Before suspending a calling thread execution mutex identified by m
handle is unlocked to enable other thread modifying variables used to check condtonals after conditional signalisation. When conditional variable is signaled mutex m
is locked.
libc wrapper: int condWait(handle_t h, handle_t m, time_t timeout)
syscalls_condSignal
GETFROMSTACK(ustack, unsigned int, h, 0);
Signals conditional given by h
.
syscalls_condBroadcast
GETFROMSTACK(ustack, unsigned int, h, 0);
Signals conditional to all waiting threads.