Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXCondition.h
1 /********************************************************************************
2 * *
3 * C o n d i t i o n C l a s s *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2004,2024 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXCONDITION_H
22 #define FXCONDITION_H
23 
24 
25 namespace FX {
26 
27 
35 class FXAPI FXCondition {
36 private:
37  FXuval data[12];
38 private:
39  FXCondition(const FXCondition&);
40  FXCondition& operator=(const FXCondition&);
41 public:
42 
44  FXCondition();
45 
49  void signal();
50 
54  void broadcast();
55 
63  FXbool wait(FXMutex& mtx);
64  FXbool wait(FXScopedMutex& smx){ return wait(smx.mutex()); }
65  FXbool wait(FXReverseMutex& rmx){ return wait(rmx.mutex()); }
66 
76  FXbool wait(FXMutex& mtx,FXTime nsec);
77  FXbool wait(FXScopedMutex& smx,FXTime nsec){ return wait(smx.mutex(),nsec); }
78  FXbool wait(FXReverseMutex& rmx,FXTime nsec){ return wait(rmx.mutex(),nsec); }
79 
81  ~FXCondition();
82  };
83 
84 }
85 
86 #endif
87 
Establish a correspondence between a C++ scope and a FXMutex, so that entering and leaving the scope ...
Definition: FXMutex.h:71
FXMutex & mutex()
Return reference to associated mutex.
Definition: FXMutex.h:122
A condition allows one or more threads to synchronize to an event.
Definition: FXCondition.h:35
The Reverse Mutex unlocks its associated FXMutex when entering the scope, and automatically relocks i...
Definition: FXMutex.h:109
Definition: FX4Splitter.h:28
FXMutex provides a mutex which can be used to enforce critical sections around updates of data shared...
Definition: FXMutex.h:31
FXMutex & mutex()
Return reference to associated mutex.
Definition: FXMutex.h:84

Copyright © 1997-2022 Jeroen van der Zijp