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 <proto/exec.h>
16 /*****************************************************************************
19 AROS_LH1(BOOL
, TryLockMutex
,
22 AROS_LHA(void *, mutex
, A0
),
25 struct ThreadBase
*, ThreadBase
, 13, Thread
)
28 Tries to lock a mutex. If the lock is already held, this function
32 mutex - mutex to lock.
35 TRUE if the lock was acquired, FALSE if the lock is already held.
45 CreateMutex(), DestroyMutex(), LockMutex(), UnlockMutex()
48 Mutexes are implemented as thin wrappers around Exec semaphores.
49 *****************************************************************************/
53 assert(mutex
!= NULL
);
55 return (BOOL
) AttemptSemaphore((struct SignalSemaphore
*) mutex
);