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

FXBarrier.h
1 /********************************************************************************
2 * *
3 * B a r r i e r C l a s s *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2004,2017 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 FXBARRIER_H
22 #define FXBARRIER_H
23 
24 
25 namespace FX {
26 
27 
41 class FXAPI FXBarrier {
42 private:
43  FXCondition condition;
44  FXMutex mutex;
45  volatile FXuint generation;
46  volatile FXuint thresh;
47  volatile FXuint count;
48 private:
49  FXBarrier(const FXBarrier&);
50  FXBarrier &operator=(const FXBarrier&);
51 public:
52 
54  FXBarrier(FXuint thr=1);
55 
60  FXbool threshold(FXuint thr);
61 
66  FXuint threshold() const { return thresh; }
67 
72  FXbool wait();
73 
80  FXbool release();
81 
83  ~FXBarrier();
84  };
85 
86 
87 }
88 
89 #endif
90 

Copyright © 1997-2016 Jeroen van der Zijp