2 * thread.library - threading and synchronisation primitives
4 * Copyright © 2007 Robert Norris
6 * This program is free software; you can redistribute it and/or modify it
7 * under the same terms as AROS itself.
10 #include "thread_intern.h"
12 #include <exec/semaphores.h>
13 #include <exec/memory.h>
14 #include <proto/exec.h>
16 /*****************************************************************************
19 AROS_LH0(void *, CreateMutex
,
24 struct ThreadBase
*, ThreadBase
, 10, Thread
)
27 Creates a mutual exclusion device (aka lock).
33 The newly created mutex, or NULL if a mutex couldn't be created.
38 Mutex mutex = CreateMutex();
43 DestroyMutex(), LockMutex(), TryLockMutex(), UnlockMutex()
46 Mutexes are implemented as thin wrappers around Exec semaphores.
48 *****************************************************************************/
52 struct SignalSemaphore
*sem
;
54 if ((sem
= (struct SignalSemaphore
*) AllocMem(sizeof(struct SignalSemaphore
), MEMF_PUBLIC
)) == NULL
)