Detab
[AROS.git] / rom / exec / addsemaphore.c
blob6264ff61053844030c43f2ac76c66a635eb5e38f
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Add a semaphore to the public list of semaphores.
6 Lang: english
7 */
8 #include "exec_intern.h"
9 #include <exec/semaphores.h>
10 #include <proto/exec.h>
12 /*****************************************************************************
14 NAME */
16 AROS_LH1(void, AddSemaphore,
18 /* SYNOPSIS */
19 AROS_LHA(struct SignalSemaphore *, sigSem, A1),
21 /* LOCATION */
22 struct ExecBase *, SysBase, 100, Exec)
24 /* FUNCTION
25 Adds a semaphore to the system public semaphore list. Since the
26 semaphore gets initialized by this function it must be free at
27 this time. Also the ln_Name field must be set.
29 INPUTS
30 sigSem - Pointer to semaphore structure
32 RESULT
34 NOTES
35 Semaphores are shared between the tasks that use them and must
36 therefore lie in public (or at least shared) memory.
38 EXAMPLE
40 BUGS
42 SEE ALSO
44 INTERNALS
46 *****************************************************************************/
48 AROS_LIBFUNC_INIT
50 /* Initialize semaphore */
51 InitSemaphore(sigSem);
53 /* Arbitrate for the semaphore list */
54 Forbid();
55 /* Add the semaphore */
56 Enqueue(&SysBase->SemaphoreList,&sigSem->ss_Link);
58 /* All done. */
59 Permit();
60 AROS_LIBFUNC_EXIT
61 } /* AddSemaphore */