Desktop/xinu_mips-1.0.2.tar/xinu_mips-1.0.2/system/newsem.c File Reference

#include <kernel.h>
#include <semaphore.h>

Include dependency graph for newsem.c:

Go to the source code of this file.

Functions

static semaphore allocsem (void)
semaphore newsem (short count)


Detailed Description

newsem, allocsem

Id
newsem.c 217 2007-07-11 01:03:18Z brylow

Definition in file newsem.c.


Function Documentation

static semaphore allocsem ( void   )  [static]

allocsem - allocate an unused semaphore and return its index. Scan the global semaphore table for a free entry, mark the entry used, and return the new semaphore

Returns:
available semaphore id on success, SYSERR on failure

Definition at line 44 of file newsem.c.

References NSEM, semtab, SFREE, sentry::state, SUSED, and SYSERR.

Referenced by newsem().

semaphore newsem ( short  count  ) 

newsem - allocate and initialize a new semaphore.

Parameters:
count - number of resources available without waiting. example: count = 1 for mutual exclusion lock
Returns:
new semaphore id on success, SYSERR on failure

Definition at line 20 of file newsem.c.

References allocsem(), sentry::count, disable(), restore(), semtab, and SYSERR.

Referenced by test_deltaQueue(), test_procQueue(), test_semaphore(), test_semaphore2(), test_semaphore3(), test_semaphore4(), and uartInit().


Generated on Thu Oct 9 22:35:07 2008 for xinu by  doxygen 1.5.5