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

FXWSQueue.h
1 /********************************************************************************
2 * *
3 * W o r k - S t e a l i n g Q u e u e *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2016,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 FXWSQUEUE_H
22 #define FXWSQUEUE_H
23 
24 namespace FX {
25 
26 
28 class FXAPI FXWSQueue {
29 private:
30  FXPtrList list;
31  volatile FXival top;
32  volatile FXival bot;
33 private:
34  FXWSQueue(const FXWSQueue&);
35  FXWSQueue &operator=(const FXWSQueue&);
36 public:
37 
39  FXWSQueue(FXival sz=256);
40 
42  FXbool setSize(FXival sz);
43 
45  FXival getSize() const { return list.no(); }
46 
48  FXival getUsed() const;
49 
51  FXival getFree() const;
52 
54  FXbool isFull() const;
55 
57  FXbool isEmpty() const;
58 
60  FXbool push(FXptr ptr);
61 
63  FXbool pop(FXptr& ptr);
64 
66  FXbool take(FXptr& ptr);
67 
69  virtual ~FXWSQueue();
70  };
71 
72 }
73 
74 #endif
75 

Copyright © 1997-2016 Jeroen van der Zijp