_condition.h

Go to the documentation of this file.
00001 
00025 /* === S T A R T =========================================================== */
00026 
00027 #ifndef __ETL__CONDITION_H_
00028 #define __ETL__CONDITION_H_
00029 
00030 /* === H E A D E R S ======================================================= */
00031 
00032 /* === M A C R O S ========================================================= */
00033 
00034 /* === C L A S S E S & S T R U C T S ======================================= */
00035 
00036 _ETL_BEGIN_NAMESPACE
00037 
00038 class condition : private mutex
00039 {
00040     bool flag;
00041 public:
00042     condition()
00043     { flag=false; }
00044     ~condition()
00045     { }
00046     void operator()()
00047     { flag=true; }
00048     void wait()
00049     {
00050         mutex::lock lock(*this);
00051 
00052         while(!flag)Yield();
00053         flag=false;
00054     }
00055     void wait_next()
00056     {
00057         mutex::lock lock(*this);
00058 
00059         flag=false;
00060         while(!flag)Yield();
00061     }
00062 };
00063 
00064 _ETL_END_NAMESPACE
00065 
00066 /* === E X T E R N S ======================================================= */
00067 
00068 /* === E N D =============================================================== */
00069 
00070 #endif

Generated on Fri Jun 22 14:07:58 2007 for ETL by  doxygen 1.5.2