Indentation fix, cleanup.
[AROS.git] / rom / exec / initsemaphore.c
blob826215a00ea669c5c5dba1c69045bf380fc8aa16
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Initialize a SignalSemaphore
6 Lang: english
7 */
9 #include "exec_intern.h"
10 #include <exec/semaphores.h>
11 #include <proto/exec.h>
13 /*****************************************************************************
15 NAME */
17 AROS_LH1I(void, InitSemaphore,
19 /* SYNOPSIS */
20 AROS_LHA(struct SignalSemaphore *, sigSem, A0),
22 /* LOCATION */
23 struct ExecBase *, SysBase, 93, Exec)
25 /* FUNCTION
26 Prepares a semaphore structure for use by the exec semaphore system,
27 i.e. this function must be called after allocating the semaphore and
28 before using it or the semaphore functions will fail.
30 INPUTS
31 sigSem - Pointer to semaphore structure
33 RESULT
35 NOTES
36 Semaphores are shared between the tasks that use them and must
37 therefore lie in public (or at least shared) memory.
39 EXAMPLE
41 BUGS
43 SEE ALSO
45 INTERNALS
47 *****************************************************************************/
49 AROS_LIBFUNC_INIT
51 /* Clear list of wait messages */
52 sigSem->ss_WaitQueue.mlh_Head = (struct MinNode *)&sigSem->ss_WaitQueue.mlh_Tail;
53 sigSem->ss_WaitQueue.mlh_Tail = NULL;
54 sigSem->ss_WaitQueue.mlh_TailPred = (struct MinNode *)&sigSem->ss_WaitQueue.mlh_Head;
56 /* Set type of Semaphore */
57 sigSem->ss_Link.ln_Type = NT_SIGNALSEM;
59 /* Semaphore is currently unused */
60 sigSem->ss_NestCount = 0;
62 /* Semaphore has no owner yet */
63 sigSem->ss_Owner = 0;
65 /* Semaphore has no queue */
66 sigSem->ss_QueueCount = -1;
68 AROS_LIBFUNC_EXIT
69 } /* InitSemaphore */