home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / rom / exec / addsemaphore.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-09  |  1.9 KB  |  85 lines

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