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

QUANTAts_thread_c.hxx

00001 /****************************************************************************** 00002 * QUANTA - A toolkit for High Performance Data Sharing 00003 * Copyright (C) 2003 Electronic Visualization Laboratory, 00004 * University of Illinois at Chicago 00005 * 00006 * This library is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU Lesser General Public License as published by 00008 * the Free Software Foundation; either Version 2.1 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, but 00012 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00013 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 00014 * License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser Public License along 00017 * with this library; if not, write to the Free Software Foundation, Inc., 00018 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 * 00020 * Direct questions, comments etc about Quanta to cavern@evl.uic.edu 00021 *****************************************************************************/ 00022 00023 #ifndef _QUANTAPLUS_THREAD_C 00024 #define _QUANTAPLUS_THREAD_C 00025 00026 #include <QUANTA/QUANTAinit.hxx> 00027 #include <QUANTA/QUANTAglobals.hxx> 00028 00029 typedef void* (*QUANTA_THREADED_FUNC)(void*); 00030 00031 #ifdef QUANTA_USE_PTHREADS 00032 typedef pthread_t QUANTA_THREAD_T; 00033 #elif defined(WIN32) && defined(QUANTA_USE_WINDOWSTHREADS) 00034 typedef unsigned QUANTA_THREAD_T; 00035 // typedef unsigned (__stdcall *QUANTA_THREADED_FUNC)(void *); 00036 // typedef unsigned (__stdcall *THREAD_START) (void *); 00037 #else 00038 #error One of QUANTA_USE_PTHREADS or QUANTA_USE_WINDOWSTHREADS must be defined. 00039 #endif 00040 00041 00042 extern "C" void *entryPoint(void *arg); 00043 00044 00051 class QUANTAts_thread_c { 00052 public: 00053 QUANTAts_thread_c(void); 00054 virtual ~QUANTAts_thread_c(void); 00055 00056 00057 // run() is not a pure virtual for 00058 // backwards compatability with original thread class 00059 virtual void run(void) {} 00060 00070 int create(void * (*threaded_func)(void *), void *arg); 00071 void create(void); 00072 00073 00075 QUANTA_THREAD_T *getThread(); 00076 00077 inline void start(void) { _running = 1; } 00078 inline void stop(void) { _running = 0; } 00079 00083 inline bool isRunning(void) const { return _running; } 00084 00085 00090 bool detach(void); 00091 00092 00097 bool join(void); 00098 00099 00100 private: 00101 QUANTA_THREAD_T itsThread; 00102 bool _initted; 00103 bool _running; 00104 }; 00105 00106 00107 #endif

Generated on Tue Jun 6 16:06:25 2006 for QUANTA by doxygen 1.3.8