Threads synchronization¶
syscalls_phMutexCreate¶
GETFROMSTACK(ustack, handle_t *, h, 0);
GETFROMSTACK(ustack, const struct lockAttr *, attr, 1);
Creates mutex and returns resource handle h. Mutex attributes are specified in attr structure.
Libc wrappers:
syscalls_mutexLock (syscalls_phMutexLock)¶
GETFROMSTACK(ustack, handle_t, h, 0);
Locks mutex given by handle h. If it is already locked, blocks until it becomes available.
Libc wrappers:
syscalls_mutexTry¶
GETFROMSTACK(ustack, handle_t, h, 0);
Tries once to lock mutex given by handle h. If it is already locked, fails with -EBUSY.
Libc wrapper:
int mutexTry(handle_t h)
syscalls_mutexUnlock¶
GETFROMSTACK(ustack, handle_t, h, 0);
Unlocks mutex given by h.
Libc wrapper:
int mutexUnlock(handle_t h)
syscalls_phCondCreate¶
GETFROMSTACK(ustack, handle_t *, h, 0);
GETFROMSTACK(ustack, const struct condAttr *, attr, 1);
Creates conditional variable and returns its handle in variable h. Conditional variable attributes are specified in
attr structure.
Libc wrappers:
syscalls_condWait (syscalls_phCondWait)¶
GETFROMSTACK(ustack, handle_t, h, 0);
GETFROMSTACK(ustack, handle_t, 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 conditionals after conditional signalization. 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, handle_t, h, 0);
Signals conditional given by h to at least one waiting thread.
Libc wrapper:
int condSignal(handle_t h)
syscalls_condBroadcast¶
GETFROMSTACK(ustack, handle_t, h, 0);
Signals conditional given by h to all waiting threads.
Libc wrapper:
int condBroadcast(handle_t h)
syscalls_resourceDestroy¶
GETFROMSTACK(ustack, handle_t, h, 0);
Deletes the resource given by h from process. Has additional effects depending on the resource.
Libc wrapper:
int resourceDestroy(handle_t h)