2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
5 Desc: Add a semaphore to the public list of semaphores.
9 #include <exec/semaphores.h>
10 #include <proto/exec.h>
12 #include "exec_intern.h"
13 #include "exec_debug.h"
15 /*****************************************************************************
19 AROS_LH1(void, AddSemaphore
,
22 AROS_LHA(struct SignalSemaphore
*, sigSem
, A1
),
25 struct ExecBase
*, SysBase
, 100, Exec
)
28 Adds a semaphore to the system public semaphore list. Since the
29 semaphore gets initialized by this function it must be free at
30 this time. Also the ln_Name field must be set.
33 sigSem - Pointer to semaphore structure
38 Semaphores are shared between the tasks that use them and must
39 therefore lie in public (or at least shared) memory.
49 *****************************************************************************/
53 /* Initialize semaphore */
54 InitSemaphore(sigSem
);
56 /* Arbitrate for the semaphore list */
58 #if defined(__AROSEXEC_SMP__)
59 EXEC_SPINLOCK_LOCK(&PrivExecBase(SysBase
)->SemListSpinLock
, NULL
, SPINLOCK_MODE_WRITE
);
61 /* Add the semaphore */
62 Enqueue(&SysBase
->SemaphoreList
,&sigSem
->ss_Link
);
63 #if defined(__AROSEXEC_SMP__)
64 EXEC_SPINLOCK_UNLOCK(&PrivExecBase(SysBase
)->SemListSpinLock
);