summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/threadutil.h
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2/threadutil.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/threadutil.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/threadutil.h b/noncore/multimedia/opieplayer2/threadutil.h
index 5cc4cdc..b537cc1 100644
--- a/noncore/multimedia/opieplayer2/threadutil.h
+++ b/noncore/multimedia/opieplayer2/threadutil.h
@@ -17,24 +17,30 @@
17 Boston, MA 02111-1307, USA. 17 Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#ifndef THREADUTIL_H 20#ifndef THREADUTIL_H
21#define THREADUTIL_H 21#define THREADUTIL_H
22 22
23#include <qvaluelist.h> 23#include <qvaluelist.h>
24#include <qobject.h> 24#include <qobject.h>
25#include <qguardedptr.h> 25#include <qguardedptr.h>
26 26
27class QSocketNotifier; 27class QSocketNotifier;
28 28
29extern "C"
30{
31 void *_threadutil_start_thread( void* );
32 void _threadutil_terminate_thread( void* );
33}
34
29namespace ThreadUtil 35namespace ThreadUtil
30{ 36{
31 37
32 class Mutex 38 class Mutex
33 { 39 {
34 friend class WaitCondition; 40 friend class WaitCondition;
35 public: 41 public:
36 Mutex(); 42 Mutex();
37 ~Mutex(); 43 ~Mutex();
38 44
39 void lock(); 45 void lock();
40 void unlock(); 46 void unlock();
@@ -72,24 +78,46 @@ namespace ThreadUtil
72 78
73 void wakeOne(); 79 void wakeOne();
74 void wakeAll(); 80 void wakeAll();
75 81
76 private: 82 private:
77 struct Data; 83 struct Data;
78 Data *d; 84 Data *d;
79 85
80 WaitCondition( const WaitCondition & ); 86 WaitCondition( const WaitCondition & );
81 WaitCondition &operator=( const WaitCondition & ); 87 WaitCondition &operator=( const WaitCondition & );
82 }; 88 };
83 89
90 class Thread
91 {
92 friend void *::_threadutil_start_thread( void* );
93 friend void ::_threadutil_terminate_thread( void* );
94 public:
95 Thread();
96 virtual ~Thread();
97
98 void start();
99 void terminate();
100
101 bool wait();
102
103 static void exit();
104 protected:
105 virtual void run() = 0;
106
107 private:
108 struct Data;
109 Data *d;
110 };
111
84 class OnewayNotifier : public QObject 112 class OnewayNotifier : public QObject
85 { 113 {
86 Q_OBJECT 114 Q_OBJECT
87 public: 115 public:
88 OnewayNotifier(); 116 OnewayNotifier();
89 ~OnewayNotifier(); 117 ~OnewayNotifier();
90 118
91 void notify(); 119 void notify();
92 120
93 signals: 121 signals:
94 void awake(); 122 void awake();
95 123