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/types.h>
13 #include <proto/exec.h>
16 /*****************************************************************************
19 AROS_LH1(BOOL
, DestroyCondition
,
22 AROS_LHA(void *, cond
, A0
),
25 struct ThreadBase
*, ThreadBase
, 16, Thread
)
28 Destroys a condition variable.
31 cond - the condition variable to destroy.
34 TRUE if the condition was destroyed, otherwise FALSE.
37 You cannot destroy a condition variable if other threads are waiting on
41 DestroyCondition(cond);
46 CreateCondition(), WaitCondition(), SignalCondition(),
51 *****************************************************************************/
55 struct _Condition
*c
= (struct _Condition
*) cond
;
59 /* we can only destroy the cond if noone is waiting on it */
60 ObtainSemaphoreShared(&c
->lock
);
62 ReleaseSemaphore(&c
->lock
);
66 FreeMem(c
, sizeof(struct _Condition
));
71 } /* DestroyCondition */