A semaphore is an object, which has to be created by the tce_sem_init function. After initializing, three additional operations are available:
-
tce_sem_up -- increments the semaphore, when value is now 0, the first thread blocked on this semaphore will be allowed to proceed, and the counter will be set to a negative value again.
-
tce_sem_down -- tries to decrement the specified semaphore, if the value already less than 0 the thread issuing this operation will be blocked on that semaphore and the value will not be changed.
-
tce_sem_free -- allows to proceed all threads which have been blocked on this semaphore, the semaphore counter will be reset to 0.
|