simplerexx updated:
[AROS.git] / rom / exec / obtainsemaphore.c
blob082c1c35c12e5cb530bb7194894b6243cceb9ca1
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Lock a semaphore.
6 Lang: english
7 */
9 #include <exec/semaphores.h>
10 #include <aros/atomic.h>
12 #include "exec_intern.h"
13 #include "exec_util.h"
14 #include "semaphores.h"
16 /*****************************************************************************/
17 #undef Exec
18 #ifdef UseExecstubs
19 # define Exec _Exec
20 #endif
22 /* NAME */
23 #include <proto/exec.h>
25 AROS_LH1(void, ObtainSemaphore,
27 /* SYNOPSIS */
28 AROS_LHA(struct SignalSemaphore *, sigSem, A0),
30 /* LOCATION */
31 struct ExecBase *, SysBase, 94, Exec)
33 /* FUNCTION
34 Obtain an exclusive lock on a semaphore. If the semaphore is already
35 in use by another task this function will wait until the semaphore
36 becomes free.
38 INPUTS
39 sigSem - Pointer to semaphore structure
41 RESULT
43 NOTES
44 This function preserves all registers.
46 EXAMPLE
48 BUGS
50 SEE ALSO
51 ReleaseSemaphore()
53 INTERNALS
55 *****************************************************************************/
57 #undef Exec
59 AROS_LIBFUNC_INIT
61 struct TraceLocation tp = CURRENT_LOCATION("ObtainSemaphore");
62 struct Task *me = FindTask(NULL);
64 InternalObtainSemaphore(sigSem, me, &tp, SysBase);
66 AROS_LIBFUNC_EXIT
67 } /* ObtainSemaphore */