Diffstat (limited to 'noncore/multimedia/opieplayer2/threadutil.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/threadutil.h | 28 |
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 @@ -23,12 +23,18 @@ #include <qvaluelist.h> #include <qobject.h> #include <qguardedptr.h> class QSocketNotifier; +extern "C" +{ + void *_threadutil_start_thread( void* ); + void _threadutil_terminate_thread( void* ); +} + namespace ThreadUtil { class Mutex { friend class WaitCondition; @@ -78,12 +84,34 @@ namespace ThreadUtil Data *d; WaitCondition( const WaitCondition & ); WaitCondition &operator=( const WaitCondition & ); }; + class Thread + { + friend void *::_threadutil_start_thread( void* ); + friend void ::_threadutil_terminate_thread( void* ); + public: + Thread(); + virtual ~Thread(); + + void start(); + void terminate(); + + bool wait(); + + static void exit(); + protected: + virtual void run() = 0; + + private: + struct Data; + Data *d; + }; + class OnewayNotifier : public QObject { Q_OBJECT public: OnewayNotifier(); ~OnewayNotifier(); |