00001 /* 00002 wefts_moaning.h 00003 Moaning thread abstract class 00004 00005 $Id: wefts_moaning.h,v 1.8 2004/03/28 21:45:40 jonnymind Exp $ 00006 --------------------------------------------- 00007 Begin : 2003-08-04 18:00 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 #ifndef WT_MOANING_H 00022 #define WT_MOANING_H 00023 00024 #include <wefts_fastcond.h> 00025 #include <wefts_thread.h> 00026 00027 namespace Wefts { 00028 00115 class MoaningThread: public Thread, CleanupHandler 00116 { 00117 00118 private: 00120 bool m_canJoin; 00121 00123 volatile int m_joiners; 00124 00126 volatile bool m_dying; 00127 00128 protected: 00130 FastCondition m_cond; 00131 00139 int joiners() { return m_joiners; } 00140 00154 void blockJoiners(); 00155 00156 public: 00158 MoaningThread(); 00159 00170 void *join() throw( NotJoinableError ); 00171 00172 00185 virtual void executionEnd(); 00186 00190 virtual void handleCleanup( int code, void *caller = 0 ); 00191 }; 00192 00193 } 00194 00195 #endif 00196 /* end of wefts_moaning.h */