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

Thread.h

00001 /* hey emacs! -*- Mode: C++; c-file-style: "stroustrup"; indent-tabs-mode: nil -*- */
00002 /*
00003  * Thread.h
00004  *
00005  * $Id: Thread.h,v 1.3 2000/12/27 16:59:27 rex Exp $
00006  *
00007  * Copyright (c) 2000 Benoit Joly <benoit@dhis.net>
00008  *
00009  * DDT comes with ABSOLUTELY NO WARRANTY and is licenced under the
00010  * GNU General Public License (version 2 or later). This license
00011  * can be retrieved from http://www.gnu.org/copyleft/gnu.html.
00012  *
00013  */
00014 
00015 #ifndef THREAD_H
00016 #define THREAD_H
00017 
00018 #include <pthread.h>
00019 #include "Mutex.h"
00020 
00026 class Thread;
00027 class Thread
00028 {
00029 
00030   public:
00031 
00033     Thread ();
00034 
00036     Thread (void *);
00037 
00039     virtual ~Thread ();
00040 
00042     void start (void);
00043     
00048     static void join (Thread* thread_id);
00049     
00051     void cancel ();
00052     
00054     static void detach (Thread *thread_id);
00055 
00056     static void cleanUpDispatch (void *);    
00057     static void *dispatchStart(void *);
00058 
00060     virtual void *run (void *) = 0;
00061 
00063     virtual void cleanUp () = 0;
00064     
00066     bool isAlive (void);
00067     
00072     static void sleepInSecond (double);
00073     
00074   protected:
00076     void *a_arguments;
00077 
00079     pthread_t a_thread;
00080     
00082     int getThreadID (void);
00083     
00085     void setIsAlive (bool);
00086     
00088     bool a_isAlive;
00089     
00091     Mutex a_protectCancel;
00092     
00093   private:
00094     
00095 };
00096 
00097 #endif

Generated on Tue Sep 13 01:32:47 2005 for DDT Project by  doxygen 1.4.4