home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / aros / source / exec / semaphores / src / initsemaphore.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-16  |  1.4 KB  |  65 lines

  1. /*
  2.     $Id$
  3.     $Log$
  4.     Desc:
  5.     Lang: english
  6. */
  7. #include "exec_intern.h"
  8.  
  9. /*****************************************************************************
  10.  
  11.     NAME */
  12.     #include <exec/semaphores.h>
  13.     #include <clib/exec_protos.h>
  14.  
  15.     __AROS_LH1I(void, InitSemaphore,
  16.  
  17. /*  SYNOPSIS */
  18.     __AROS_LA(struct SignalSemaphore *, sigSem, A0),
  19.  
  20. /*  LOCATION */
  21.     struct ExecBase *, SysBase, 93, Exec)
  22.  
  23. /*  FUNCTION
  24.     Prepares a semaphore structure for use by the exec semaphore system,
  25.     i.e. this function must be called after allocating the semaphore and
  26.     before using it or the semaphore functions will fail.
  27.  
  28.     INPUTS
  29.     sigSem - Pointer to semaphore structure
  30.  
  31.     RESULT
  32.  
  33.     NOTES
  34.     Semaphores are shared between the tasks that use them and must
  35.     therefore lie in public (or at least shared) memory.
  36.  
  37.     EXAMPLE
  38.  
  39.     BUGS
  40.  
  41.     SEE ALSO
  42.  
  43.     INTERNALS
  44.  
  45.     HISTORY
  46.     29-10-95    digulla automatically created from
  47.                 exec_lib.fd and clib/exec_protos.h
  48.     21-01-96    fleischer implementation
  49.  
  50. *****************************************************************************/
  51. {
  52.     __AROS_FUNC_INIT
  53.  
  54.     /* Clear list of wait messages */
  55.     sigSem->ss_WaitQueue.mlh_Head     = (struct MinNode *)&sigSem->ss_WaitQueue.mlh_Tail;
  56.     sigSem->ss_WaitQueue.mlh_Tail     = NULL;
  57.     sigSem->ss_WaitQueue.mlh_TailPred = (struct MinNode *)&sigSem->ss_WaitQueue.mlh_Head;
  58.  
  59.     /* Semaphore is currently unused */
  60.     sigSem->ss_NestCount=0;
  61.  
  62.     __AROS_FUNC_EXIT
  63. } /* InitSemaphore */
  64.  
  65.