revert between 56095 -> 55830 in arch
[AROS.git] / rom / exec / findsemaphore.c
blobd7b218e15102b3c1f7405c8feba754fa688daa55
1 /*
2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Search a semaphore by name
6 Lang: english
7 */
9 #include <exec/execbase.h>
10 #include <aros/libcall.h>
11 #include <proto/exec.h>
13 #include "exec_intern.h"
14 #include "exec_debug.h"
16 /*****************************************************************************
18 NAME */
20 AROS_LH1(struct SignalSemaphore *, FindSemaphore,
22 /* SYNOPSIS */
23 AROS_LHA(CONST_STRPTR, name, A1),
25 /* LOCATION */
26 struct ExecBase *, SysBase, 99, Exec)
28 /* FUNCTION
29 Find a semaphore with a given name in the system global semaphore list.
30 Note that this call doesn't arbitrate for the list - use Forbid() to
31 do this yourself.
33 INPUTS
34 name - Pointer to name.
36 RESULT
37 Address of semaphore structure found or NULL.
39 NOTES
41 EXAMPLE
43 BUGS
45 SEE ALSO
47 INTERNALS
49 ******************************************************************************/
51 AROS_LIBFUNC_INIT
53 struct SignalSemaphore *retVal;
55 /* Nothing spectacular - just look into the list */
56 #if defined(__AROSEXEC_SMP__)
57 EXEC_SPINLOCK_LOCK(&PrivExecBase(SysBase)->SemListSpinLock, NULL, SPINLOCK_MODE_READ);
58 #endif
59 retVal = (struct SignalSemaphore *)FindName(&SysBase->SemaphoreList,name);
60 #if defined(__AROSEXEC_SMP__)
61 EXEC_SPINLOCK_UNLOCK(&PrivExecBase(SysBase)->SemListSpinLock);
62 #endif
63 return retVal;
65 AROS_LIBFUNC_EXIT
66 } /* FindSemaphore */