~ubuntu-branches/ubuntu/maverick/newsbeuter/maverick

« back to all changes in this revision

Viewing changes to include/thread.h

  • Committer: Bazaar Package Importer
  • Author(s): Nico Golde
  • Date: 2007-04-21 19:44:35 UTC
  • Revision ID: james.westby@ubuntu.com-20070421194435-21g6134ws2yvarlt
Tags: upstream-0.3
ImportĀ upstreamĀ versionĀ 0.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef AK_THREAD__H
 
2
#define AK_THREAD__H
 
3
 
 
4
#include <pthread.h>
 
5
 
 
6
 
 
7
namespace newsbeuter {
 
8
 
 
9
        class thread;
 
10
 
 
11
        void * run_thread(thread * p);
 
12
 
 
13
        // TODO: implement an option to provide attributes
 
14
 
 
15
        class thread {
 
16
                public:
 
17
                        thread();
 
18
                        virtual ~thread();
 
19
                        void start();
 
20
                        void join();
 
21
 
 
22
                protected:
 
23
                        virtual void run() = 0;
 
24
                        void detach();
 
25
 
 
26
                        friend void * run_thread(thread * p);
 
27
 
 
28
                private:
 
29
                        static void cleanup(thread * p);
 
30
                        pthread_t pt;
 
31
        };
 
32
 
 
33
}
 
34
 
 
35
 
 
36
#endif