git-svn-id: svn://db.shs.com.ru/pip@319 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
6
main.cpp
6
main.cpp
@@ -72,13 +72,15 @@ int main(int argc, char *argv[]) {
|
||||
s.rootTile()->addTile(list);
|
||||
s.waitForFinish();*/
|
||||
|
||||
PIDeque<int> d;
|
||||
/*PIDeque<int> d;
|
||||
d.resize(atoi(argv[1]));
|
||||
while (1) {
|
||||
d.push_back(1);
|
||||
d.pop_front();
|
||||
piCout << d.size() << d.capacity() << d._start();
|
||||
}
|
||||
}*/
|
||||
//PIVector<PIIODevice> o;
|
||||
//o[0] = o[1];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -421,11 +421,14 @@ class PIP_EXPORT PIObject
|
||||
public:
|
||||
|
||||
//! Contructs PIObject with name "name"
|
||||
PIObject(const PIString & name = PIString());
|
||||
explicit PIObject(const PIString & name = PIString());
|
||||
|
||||
virtual ~PIObject();
|
||||
|
||||
private:
|
||||
explicit PIObject(const PIObject & );
|
||||
void operator =(const PIObject & );
|
||||
|
||||
uint _signature_;
|
||||
|
||||
public:
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
#define PIVERSION_H
|
||||
|
||||
#define PIP_VERSION_MAJOR 0
|
||||
#define PIP_VERSION_MINOR 7
|
||||
#define PIP_VERSION_REVISION 2
|
||||
#define PIP_VERSION_MINOR 8
|
||||
#define PIP_VERSION_REVISION 0
|
||||
#define PIP_VERSION_SUFFIX ""
|
||||
|
||||
#endif // PIVERSION_H
|
||||
|
||||
@@ -48,12 +48,6 @@ PIMutex::~PIMutex() {
|
||||
}
|
||||
|
||||
|
||||
PIMutex & PIMutex::operator =(const PIMutex & other) {
|
||||
init();
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void PIMutex::lock() {
|
||||
#ifdef WINDOWS
|
||||
WaitForSingleObject(mutex, INFINITE);
|
||||
|
||||
@@ -34,13 +34,12 @@ public:
|
||||
|
||||
//! Constructs unlocked mutex
|
||||
explicit PIMutex();
|
||||
|
||||
explicit PIMutex(const PIMutex & );
|
||||
|
||||
~PIMutex();
|
||||
|
||||
|
||||
PIMutex & operator =(const PIMutex & other);
|
||||
|
||||
|
||||
//! \brief Lock mutex
|
||||
//! \details If mutex is unlocked it set to locked state and returns immediate.
|
||||
//! If mutex is already locked function blocks until mutex will be unlocked
|
||||
@@ -59,6 +58,8 @@ public:
|
||||
bool isLocked() const;
|
||||
|
||||
private:
|
||||
void operator =(const PIMutex & );
|
||||
|
||||
void init();
|
||||
void destroy();
|
||||
|
||||
|
||||
@@ -105,6 +105,64 @@ bool _PITimerBase::stop() {
|
||||
|
||||
|
||||
|
||||
class _PITimerImp_Thread: public _PITimerBase {
|
||||
public:
|
||||
_PITimerImp_Thread();
|
||||
virtual ~_PITimerImp_Thread();
|
||||
protected:
|
||||
void prepareStart(double interval_ms);
|
||||
bool threadFunc(); // returns true if repeat is needed
|
||||
int wait_dt, wait_dd, wait_tick;
|
||||
private:
|
||||
virtual bool startTimer(double interval_ms);
|
||||
virtual bool stopTimer();
|
||||
static void threadFuncS(void * d) {((_PITimerImp_Thread*)d)->threadFunc();}
|
||||
void adjustTimes();
|
||||
|
||||
PIThread thread_;
|
||||
PISystemTime st_time, st_inc, st_wait, st_odt;
|
||||
};
|
||||
|
||||
|
||||
#ifdef PIP_TIMER_RT
|
||||
struct _PITimerImp_RT_Private_;
|
||||
class _PITimerImp_RT: public _PITimerBase {
|
||||
public:
|
||||
_PITimerImp_RT();
|
||||
virtual ~_PITimerImp_RT();
|
||||
protected:
|
||||
private:
|
||||
virtual bool startTimer(double interval_ms);
|
||||
virtual bool stopTimer();
|
||||
|
||||
int ti;
|
||||
_PITimerImp_RT_Private_ * priv;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
class _PITimerImp_Pool: public _PITimerImp_Thread {
|
||||
public:
|
||||
_PITimerImp_Pool();
|
||||
virtual ~_PITimerImp_Pool() {stop();}
|
||||
private:
|
||||
class Pool: public PIThread {
|
||||
public:
|
||||
Pool();
|
||||
~Pool();
|
||||
static Pool * instance();
|
||||
void add(_PITimerImp_Pool * t);
|
||||
void remove(_PITimerImp_Pool * t);
|
||||
void run();
|
||||
PIVector<_PITimerImp_Pool * > timers, to_remove;
|
||||
};
|
||||
virtual bool startTimer(double interval_ms);
|
||||
virtual bool stopTimer();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
_PITimerImp_Thread::_PITimerImp_Thread() {
|
||||
thread_.setName("__S__PITimerImp_Thread::thread");
|
||||
wait_dt = 100;
|
||||
|
||||
@@ -71,63 +71,6 @@ protected:
|
||||
|
||||
|
||||
|
||||
class _PITimerImp_Thread: public _PITimerBase {
|
||||
public:
|
||||
_PITimerImp_Thread();
|
||||
virtual ~_PITimerImp_Thread();
|
||||
protected:
|
||||
void prepareStart(double interval_ms);
|
||||
bool threadFunc(); // returns true if repeat is needed
|
||||
int wait_dt, wait_dd, wait_tick;
|
||||
private:
|
||||
virtual bool startTimer(double interval_ms);
|
||||
virtual bool stopTimer();
|
||||
static void threadFuncS(void * d) {((_PITimerImp_Thread*)d)->threadFunc();}
|
||||
void adjustTimes();
|
||||
|
||||
PIThread thread_;
|
||||
PISystemTime st_time, st_inc, st_wait, st_odt;
|
||||
};
|
||||
|
||||
|
||||
#ifdef PIP_TIMER_RT
|
||||
struct _PITimerImp_RT_Private_;
|
||||
class _PITimerImp_RT: public _PITimerBase {
|
||||
public:
|
||||
_PITimerImp_RT();
|
||||
virtual ~_PITimerImp_RT();
|
||||
protected:
|
||||
private:
|
||||
virtual bool startTimer(double interval_ms);
|
||||
virtual bool stopTimer();
|
||||
|
||||
int ti;
|
||||
_PITimerImp_RT_Private_ * priv;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
class _PITimerImp_Pool: public _PITimerImp_Thread {
|
||||
public:
|
||||
_PITimerImp_Pool();
|
||||
virtual ~_PITimerImp_Pool() {stop();}
|
||||
private:
|
||||
class Pool: public PIThread {
|
||||
public:
|
||||
Pool();
|
||||
~Pool();
|
||||
static Pool * instance();
|
||||
void add(_PITimerImp_Pool * t);
|
||||
void remove(_PITimerImp_Pool * t);
|
||||
void run();
|
||||
PIVector<_PITimerImp_Pool * > timers, to_remove;
|
||||
};
|
||||
virtual bool startTimer(double interval_ms);
|
||||
virtual bool stopTimer();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class PITimer: public PIObject {
|
||||
PIOBJECT_SUBCLASS(PITimer, PIObject)
|
||||
|
||||
Reference in New Issue
Block a user