aboutsummaryrefslogtreecommitdiff
path: root/lib/base/thread.h
blob: f71300579238c22b839f14e69d051e0a1776b30c (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 hard=false);
};

#endif