aboutsummaryrefslogtreecommitdiff
path: root/include/thread.h
blob: 0d2b09d7bd5b91b7a57de5781fc525664af10f74 (plain) (blame)
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
28
29
30
31
32
33
34
35
36
#ifndef AK_THREAD__H
#define AK_THREAD__H

#include <pthread.h>


namespace newsbeuter {

	class thread;

	void * run_thread(thread * p);

	// TODO: implement an option to provide attributes

	class thread {
		public:
			thread();
			virtual ~thread();
			void start();
			void join();

		protected:
			virtual void run() = 0;
			void detach();

			friend void * run_thread(thread * p);

		private:
			static void cleanup(thread * p);
			pthread_t pt;
	};

}


#endif