Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   Related Pages  

wefts_barrier.h

Go to the documentation of this file.
00001 /*
00002    wefts_barrier.h
00003    Execution barrier for wefts.
00004 
00005    $Id: wefts_barrier.h,v 1.3 2003/08/15 00:43:58 jonnymind Exp $
00006 ---------------------------------------------
00007    Begin      : 2003-08-03 17:50
00008    Author     : Giancarlo Niccolai
00009 
00010    Last modified because:
00011 
00012 */
00013 
00014 /**************************************************************************
00015 *   This program is free software; you can redistribute it and/or modify  *
00016 *   it under the terms of the GNU Library General Public License as       *
00017 *   published by the Free Software Foundation; either version 2.1 of the  *
00018 *   License, or (at your option) any later version.                       *
00019 ***************************************************************************/
00020 
00021 
00022 #ifndef WT_BARRIER_H
00023 #define WT_BARRIER_H
00024 
00025 #include <wefts_fastcond.h>
00026 
00027 
00028 namespace Wefts {
00029 
00046 class Barrier {
00047 private:
00048    volatile unsigned int m_treshold;
00049    volatile unsigned int m_subscribed;
00050    FastCondition m_cond;   // should be automagically initialized and removed
00051    volatile bool m_release;
00052    volatile bool m_open;
00053 
00054 public:
00063    Barrier( unsigned int treshold=0, bool open = false );
00064 
00068    void wait();
00069 
00071    inline unsigned int waiting() { return m_subscribed; }
00072 
00074    inline unsigned int treshold() { return m_treshold; }
00075 
00078    inline bool blocking() { return !m_open; }
00079 
00084    void treshold( unsigned int th );
00085 
00090    void release();
00091 
00096    void open();
00097 
00100    void close();
00101 
00102 };
00103 
00104 }
00105 
00106 #endif
00107 /* end of wefts_barrier.h */

Generated on Mon Aug 18 05:53:37 2003 for Wefts by doxygen1.2.18