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

vdkthread.h

00001 /* 00002 * =========================== 00003 * VDK Visual Development Kit 00004 * Version 0.6 00005 * Jan 1999 00006 * =========================== 00007 * 00008 * Copyright (C) 1999, Salmaso Raffaele 00009 * Developed by Salmaso Raffaele <r.salmaso@flashnet.it> 00010 * 00011 * This library is free software; you can redistribute it and/or 00012 * modify it under the terms of the GNU Library General Public 00013 * License as published by the Free Software Foundation; either 00014 * version 2 of the License, or (at your option) any later version. 00015 * 00016 * This library is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 * Library General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Library General Public 00022 * License along with this library; if not, write to the Free Software 00023 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00024 * 02111-1307, USA. 00025 */ 00026 00027 #ifndef VDKTHREAD_H 00028 #define VDKTHREAD_H 00029 00030 #include <pthread.h> 00031 00032 enum VDKMutexEnum { 00033 VDKMUTEX_OK = 0, 00034 VDKMUTEX_ERROR 00035 }; 00039 enum VDKThreadEnum { 00040 VDKTHREAD_IDLE = 1, 00041 VDKTHREAD_RUNNING, 00042 VDKTHREAD_STOPPED, 00043 VDKTHREAD_EXITED, 00044 VDKTHREAD_CANNOT_CREATE, 00045 VDKTHREAD_IS_YET_RUNNING 00046 }; 00047 00048 class VDKMutex { 00049 private: 00050 pthread_mutex_t mutex; 00051 public: 00052 VDKMutex (); 00053 ~VDKMutex (); 00054 VDKMutexEnum Wait (long time = 0); 00055 VDKMutexEnum Release (); 00056 VDKMutexEnum Lock (); 00057 }; 00058 00092 class VDKThread { 00093 protected: 00094 pthread_t id; 00098 void Exit (void * status = 0); 00099 static void * EntryPoint (void * arg); 00100 virtual void Execute (); 00101 public: 00102 VDKThread (); 00103 virtual ~VDKThread (); 00107 VDKThreadEnum Start (void * = NULL); 00111 VDKThreadEnum Stop (); 00115 void * Wait (); 00119 VDKThreadEnum state; 00123 unsigned int GetID () {return (unsigned long) id;}; 00124 }; 00125 00126 #endif

Generated on Tue Aug 17 12:39:51 2004 for vdk 2.4.0 by doxygen 1.3.7