#include <semaphore.h>
Semaphores are used to synchronize different threads of control. This course does not place an emphasize on the finer points of synchronization, so don't be surprised or dissappointed if you don't understand any of this. If you have questions, feel free to approach a TA on hours.
Semaphores in brickOS are POSIX 1003.b compliant. They must be declared, then initialized, before they can be used.
value
.
Parameters: |
sem
-
a pointer to the semaphore being initialized
pshared not used by LegOS, usually set to indicate whether the semaphore is shared between processes or not. Just leave it at 0 value The initial value that you want to give the semaphore |
sem
was successfully decremented,
0 otherwise
Parameters: | sem - the semaphore to post |
Parameters: |
sem
-
the semaphore
sval the integer to store the value of the semaphore into |
Parameters: | sem - the semaphore |