git-svn-id: svn://db.shs.com.ru/pip@513 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -29,6 +29,33 @@
|
||||
#include "pimutex.h"
|
||||
#include "piobject.h"
|
||||
|
||||
class PIThread;
|
||||
|
||||
class __PIThreadCollection {
|
||||
public:
|
||||
static __PIThreadCollection * instance();
|
||||
void registerThread(PIThread * t);
|
||||
void unregisterThread(PIThread * t);
|
||||
PIVector<PIThread * > threads() const;
|
||||
void lock() {mutex.lock();}
|
||||
void unlock() {mutex.unlock();}
|
||||
private:
|
||||
PIVector<PIThread * > threads_;
|
||||
mutable PIMutex mutex;
|
||||
};
|
||||
|
||||
|
||||
class __PIThreadCollection_Initializer__ {
|
||||
public:
|
||||
__PIThreadCollection_Initializer__();
|
||||
~__PIThreadCollection_Initializer__();
|
||||
static int count_;
|
||||
static __PIThreadCollection * __instance__;
|
||||
};
|
||||
|
||||
static __PIThreadCollection_Initializer__ __PIThreadCollection_initializer__;
|
||||
|
||||
|
||||
typedef void (*ThreadFunc)(void * );
|
||||
|
||||
class PIP_EXPORT PIThread: public PIObject
|
||||
@@ -98,6 +125,8 @@ public:
|
||||
|
||||
//! \brief Returns thread ID
|
||||
llong tid() const {return tid_;}
|
||||
|
||||
void * handle() const;
|
||||
|
||||
static void __thread_func__(void*);
|
||||
static void __thread_func_once__(void*);
|
||||
@@ -189,11 +218,12 @@ protected:
|
||||
int delay_, policy_;
|
||||
llong tid_;
|
||||
void * data_;
|
||||
PIMutex mutex_;
|
||||
mutable PIMutex mutex_;
|
||||
PITimeMeasurer tmf_, tms_, tmr_;
|
||||
PIThread::Priority priority_;
|
||||
ThreadFunc ret_func;
|
||||
PRIVATE_DECLARATION
|
||||
};
|
||||
|
||||
|
||||
#endif // PITHREAD_H
|
||||
|
||||
Reference in New Issue
Block a user