ObjFW
OFCondition.h
1 /*
2  * Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This file is part of ObjFW. It may be distributed under the terms of the
7  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
8  * the packaging of this file.
9  *
10  * Alternatively, it may be distributed under the terms of the GNU General
11  * Public License, either version 2 or 3, which can be found in the file
12  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
13  * file.
14  */
15 
16 #import "OFMutex.h"
17 
18 #import "condition.h"
19 
20 OF_ASSUME_NONNULL_BEGIN
21 
22 @class OFDate;
23 
29 OF_SUBCLASSING_RESTRICTED
30 @interface OFCondition: OFMutex
31 {
32  of_condition_t _condition;
33  bool _conditionInitialized;
34 }
35 
41 + (instancetype)condition;
42 
50 - (void)wait;
51 
52 #ifdef OF_AMIGAOS
62 - (void)waitForConditionOrExecSignal: (ULONG *)signalMask;
63 #endif
64 
75 - (bool)waitForTimeInterval: (of_time_interval_t)timeInterval;
76 
77 #ifdef OF_AMIGAOS
89 - (bool)waitForTimeInterval: (of_time_interval_t)timeInterval
90  orExecSignal: (ULONG *)signalMask;
91 #endif
92 
103 - (bool)waitUntilDate: (OFDate *)date;
104 
105 #ifdef OF_AMIGAOS
117 - (bool)waitUntilDate: (OFDate *)date orExecSignal: (ULONG *)signalMask;
118 #endif
119 
123 - (void)signal;
124 
128 - (void)broadcast;
129 @end
130 
131 OF_ASSUME_NONNULL_END
double of_time_interval_t
A time interval in seconds.
Definition: OFObject.h:138
A class implementing a condition variable for thread synchronization.
Definition: OFCondition.h:31
A class for storing, accessing and comparing dates.
Definition: OFDate.h:36
A class for creating mutual exclusions.
Definition: OFMutex.h:30