summaryrefslogtreecommitdiff
path: root/include/thread.h
blob: 68c8a9bae9c6d47ab6ceec18475b0004dc50fe16 (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(void * p);

	// TODO: implement an option to provide attributes

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

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

			friend void * run_thread(void * p);

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

}


#endif