Debian Codegraph @

thread_linux.h

raw symbols SCIP
1 /*
2 * Licensed under CLIFE license. See LICENCE.TXT
3 *
4 * Produced by: Jeff Lait
5 *
6 * CLIFE Development
7 *
8 * NAME: thread_linux.h ( CLIFE, C++ )
9 *
10 * COMMENTS:
11 * Attempt at a threading class.
12 */
13
14 #ifndef __threadlinux_h__
15 #define __threadlinux_h__
16
17 #include "thread.h"
18
19 #include <stdlib.h>
20 #include <unistd.h>
21 #include <limits.h>
22 #include <sys/wait.h>
23 #include <sys/types.h>
24 #include <pthread.h>
25
26 class THREAD_LINUX : public THREAD
27 {
28 public:
29 // (Re)starts this, invoking the given function as the main
30 // thread program.
31 virtual void start(THREADmainFunc func, void *data);
32
33 // Blocks until this is done
34 virtual void join();
35
36 // Terminates this thread.
37 virtual void kill();
38
39 THREAD_LINUX();
40 virtual ~THREAD_LINUX();
41 protected:
42 // Blocks until the thread is ready to process.
43 virtual void waittillimready();
44 virtual void iamdonenow();
45 virtual void jobsready();
46
47 pthread_t mySelf;
48 pthread_mutex_t myLock;
49 pthread_cond_t myStateChangeEvent;
50 bool myRunning;
51 bool myExists;
52 };
53
54 #endif
55