Embedded Xinu Network Playground COSC3300Fall2012
Semaphore Subsystem

The Semaphore Subsystem implements the classic synchronization primitive. More...

Functions

syscall wait (semaphore)
syscall signal (semaphore)
syscall signaln (semaphore, int)
semaphore semcreate (int)
syscall semfree (semaphore)
syscall semcount (semaphore)

Detailed Description

The Semaphore Subsystem implements the classic synchronization primitive.


Function Documentation

syscall semcount ( semaphore  sem)

Return a semaphore's count.

Parameters:
semtarget semaphore
Returns:
count from semtab entry on success, SYSERR on failure
semaphore semcreate ( int  count)

Create and initialize a semaphore, returning its ID.

Parameters:
countresources available.
Returns:
new semaphore ID on success, SYSERR on failure
syscall semfree ( semaphore  sem)

Deallocate a semaphore.

Reset the semaphore count, releasing any threads in the waiting queue. Deallocate entry in global semaphore table.

Parameters:
semtarget semaphore
Returns:
OK on success, SYSERR on failure
syscall signal ( semaphore  sem)

signal a semaphore, releasing one waiting thread

Parameters:
semtarget semaphore
Returns:
OK on success, SYSERR on failure
syscall signaln ( semaphore  sem,
int  count 
)

Signal a semaphore n times, releasing n waiting threads.

Parameters:
semtarget semaphore
countnumber of times to signal
Returns:
OK on success, SYSERR on failure
syscall wait ( semaphore  sem)

Make current process wait on a semaphore.

Parameters:
semtarget semaphore
Returns:
OK on success, SYSERR on failure