aboutsummaryrefslogtreecommitdiff
path: root/lib/base/thread.h
blob: f6c750aff53894aabac7578042ff463437e7facd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef __lib_base_thread_h
#define __lib_base_thread_h

#include <pthread.h>
#include <signal.h>

class eThread
{
	pthread_t the_thread;
	static void *wrapper(void *ptr);
	int alive;
	static void thread_completed(void *p);
public:
	bool thread_running() { return alive; }
	eThread();
	virtual ~eThread();

	void run(int prio=0, int policy=0);

	virtual void thread()=0;
	virtual void thread_finished() { }
	void sendSignal(int sig);

	void kill(bool sendcancel=false);
};

#endif