ObjFW
OFCondition.h
1 /*
2  * Copyright (c) 2008-2023 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 #import "OFPlainCondition.h"
18 
19 OF_ASSUME_NONNULL_BEGIN
20 
21 @class OFDate;
22 
28 OF_SUBCLASSING_RESTRICTED
29 @interface OFCondition: OFMutex
30 {
31  OFPlainCondition _condition;
32  bool _conditionInitialized;
33 }
34 
40 + (instancetype)condition;
41 
51 - (void)wait;
52 
53 #if defined(OF_AMIGAOS) || defined(DOXYGEN)
64 - (void)waitForConditionOrExecSignal: (ULONG *)signalMask;
65 #endif
66 
78 - (bool)waitForTimeInterval: (OFTimeInterval)timeInterval;
79 
80 #if defined(OF_AMIGAOS) || defined(DOXYGEN)
93 - (bool)waitForTimeInterval: (OFTimeInterval)timeInterval
94  orExecSignal: (ULONG *)signalMask;
95 #endif
96 
108 - (bool)waitUntilDate: (OFDate *)date;
109 
110 #if defined(OF_AMIGAOS) || defined(DOXYGEN)
123 - (bool)waitUntilDate: (OFDate *)date orExecSignal: (ULONG *)signalMask;
124 #endif
125 
131 - (void)signal;
132 
138 - (void)broadcast;
139 @end
140 
141 OF_ASSUME_NONNULL_END
double OFTimeInterval
A time interval in seconds.
Definition: OFObject.h:150
A class implementing a condition variable for thread synchronization.
Definition: OFCondition.h:30
A class for storing, accessing and comparing dates.
Definition: OFDate.h:30
A class for creating mutual exclusions.
Definition: OFMutex.h:34