home *** CD-ROM | disk | FTP | other *** search
/ MACD 4 / MACD4.iso / Emulatory / AROS / exec / addsemaphore.c < prev    next >
Encoding:
C/C++ Source or Header  |  1978-03-06  |  1.7 KB  |  77 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: addsemaphore.c,v 1.5 1996/10/24 15:50:42 aros Exp $
  4.     $Log: addsemaphore.c,v $
  5.     Revision 1.5  1996/10/24 15:50:42  aros
  6.     Use the official AROS macros over the __AROS versions.
  7.  
  8.     Revision 1.4  1996/08/13 13:55:56  digulla
  9.     Replaced AROS_LA by AROS_LHA
  10.     Replaced some AROS_LH*I by AROS_LH*
  11.     Sorted and added includes
  12.  
  13.     Revision 1.3  1996/08/01 17:41:03  digulla
  14.     Added standard header for all files
  15.  
  16.     Desc:
  17.     Lang: english
  18. */
  19. #include "exec_intern.h"
  20.  
  21. /*****************************************************************************
  22.  
  23.     NAME */
  24.     #include <exec/semaphores.h>
  25.     #include <clib/exec_protos.h>
  26.  
  27.     AROS_LH1(void, AddSemaphore,
  28.  
  29. /*  SYNOPSIS */
  30.     AROS_LHA(struct SignalSemaphore *, sigSem, A1),
  31.  
  32. /*  LOCATION */
  33.     struct ExecBase *, SysBase, 100, Exec)
  34.  
  35. /*  FUNCTION
  36.     Adds a semaphore to the system public semaphore list. Since the
  37.     semaphore gets initialized by this function it must be free at
  38.     this time. Also the ln_Name field must be set.
  39.  
  40.     INPUTS
  41.     sigSem - Pointer to semaphore structure
  42.  
  43.     RESULT
  44.  
  45.     NOTES
  46.     Semaphores are shared between the tasks that use them and must
  47.     therefore lie in public (or at least shared) memory.
  48.  
  49.     EXAMPLE
  50.  
  51.     BUGS
  52.  
  53.     SEE ALSO
  54.  
  55.     INTERNALS
  56.  
  57.     HISTORY
  58.  
  59. *****************************************************************************/
  60. {
  61.     AROS_LIBFUNC_INIT
  62.  
  63.     /* Intialize semaphore */
  64.     sigSem->ss_Link.ln_Type=NT_SIGNALSEM;
  65.     InitSemaphore(sigSem);
  66.  
  67.     /* Arbitrate for the semaphore list */
  68.     Forbid();
  69.     /* Add the semaphore */
  70.     Enqueue(&SysBase->SemaphoreList,&sigSem->ss_Link);
  71.  
  72.     /* All done. */
  73.     Permit();
  74.     AROS_LIBFUNC_EXIT
  75. } /* AddSemaphore */
  76.  
  77.