picofuse-objc

NXCondition.h
Go to the documentation of this file.
1 
5 #pragma once
6 #include "NXDuration.h"
7 #include "NXLocking.h"
8 #include <picofuse/sys.h>
9 
32 @interface NXCondition : NXObject <NXLocking> {
33 @private
34  sys_mutex_t *_mutex;
35  sys_cond_t *_cond;
36 }
37 
43 - (id)init;
44 
48 - (void)lock;
49 
53 - (void)unlock;
54 
59 - (void)wait;
60 
67 - (BOOL)waitForDuration:(NXDuration)duration;
68 
72 - (void)signal;
73 
77 - (void)broadcast;
78 
79 @end
Defines the NXDuration type, and constants for units of time.
void lock()
Locks it, waiting until no other thread holds it.
int64_t NXDuration
A length of time, in nanoseconds, which may be negative.
Definition: NXDuration.h:17
void unlock()
Unlocks it, which only the thread which locked it can do.
void signal()
Wakes one thread which is waiting, if there are any.
bool BOOL
A Boolean value.
Definition: runtime.h:60
void broadcast()
Wakes every thread which is waiting.
Defines the NXLocking protocol, for objects which can be locked.
The base class for objects in the Foundation framework.
Definition: NXObject.h:28
id init()
Initializes a condition.
void wait()
Unlocks it and waits until it&#39;s signalled, then locks it again.
struct objc_object * id
A pointer to an instance of a class.
Definition: runtime.h:18
A lock, and a condition which threads holding it can wait for.
Definition: NXCondition.h:32
Objects which can be locked by one thread at a time.
Definition: NXLocking.h:13