git-svn-id: svn://db.shs.com.ru/pip@699 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -162,7 +162,7 @@ private:
|
||||
return;
|
||||
}
|
||||
if (ret > 0) {
|
||||
piMSleep(1);
|
||||
piMSleep(PIP_MIN_MSLEEP);
|
||||
return;
|
||||
}
|
||||
diag_.received(1);
|
||||
|
||||
@@ -364,12 +364,12 @@ bool PIThread::waitForFinish(int timeout_msecs) {
|
||||
if (!running_) return true;
|
||||
if (timeout_msecs < 0) {
|
||||
while (running_)
|
||||
msleep(1);
|
||||
msleep(PIP_MIN_MSLEEP);
|
||||
return true;
|
||||
}
|
||||
tmf_.reset();
|
||||
while (running_ && tmf_.elapsed_m() < timeout_msecs)
|
||||
msleep(1);
|
||||
msleep(PIP_MIN_MSLEEP);
|
||||
return tmf_.elapsed_m() < timeout_msecs;
|
||||
}
|
||||
|
||||
@@ -378,12 +378,12 @@ bool PIThread::waitForStart(int timeout_msecs) {
|
||||
if (running_) return true;
|
||||
if (timeout_msecs < 0) {
|
||||
while (!running_)
|
||||
msleep(1);
|
||||
msleep(PIP_MIN_MSLEEP);
|
||||
return true;
|
||||
}
|
||||
tms_.reset();
|
||||
while (!running_ && tms_.elapsed_m() < timeout_msecs)
|
||||
msleep(1);
|
||||
msleep(PIP_MIN_MSLEEP);
|
||||
return tms_.elapsed_m() < timeout_msecs;
|
||||
}
|
||||
|
||||
@@ -424,10 +424,10 @@ void PIThread::__thread_func__(void * t) {
|
||||
ct.tmr_.reset();
|
||||
double sl(0.);
|
||||
while (1) {
|
||||
sl = piMind(ct.delay_ - ct.tmr_.elapsed_m(), PTHREAD_MIN_MSLEEP);
|
||||
sl = piMind(ct.delay_ - ct.tmr_.elapsed_m(), PIP_MIN_MSLEEP);
|
||||
#ifdef WINDOWS
|
||||
/*if (sl <= 1. && sl >= 0.) {
|
||||
piMSleep(1.);
|
||||
piMSleep(PIP_MIN_MSLEEP);
|
||||
continue;
|
||||
}*/
|
||||
#endif
|
||||
|
||||
@@ -29,12 +29,6 @@
|
||||
#include "pimutex.h"
|
||||
#include "piobject.h"
|
||||
|
||||
#ifdef FREERTOS
|
||||
# define PTHREAD_MIN_MSLEEP 10.
|
||||
#else
|
||||
# define PTHREAD_MIN_MSLEEP 1.
|
||||
#endif
|
||||
|
||||
class PIThread;
|
||||
|
||||
class PIP_EXPORT __PIThreadCollection {
|
||||
|
||||
@@ -371,7 +371,7 @@ _PITimerImp_Pool::Pool::Pool(): PIThread() {
|
||||
#ifndef FREERTOS
|
||||
timers.reserve(64);
|
||||
#endif
|
||||
start(PTHREAD_MIN_MSLEEP);
|
||||
start(PIP_MIN_MSLEEP);
|
||||
}
|
||||
|
||||
|
||||
@@ -538,11 +538,11 @@ void PITimer::tickImp() {
|
||||
bool PITimer::waitForFinish(int timeout_msecs) {
|
||||
if (timeout_msecs < 0) {
|
||||
while (isRunning())
|
||||
msleep(1);
|
||||
msleep(PIP_MIN_MSLEEP);
|
||||
return true;
|
||||
}
|
||||
PITimeMeasurer tm;
|
||||
while (isRunning() && tm.elapsed_m() < timeout_msecs)
|
||||
msleep(1);
|
||||
msleep(PIP_MIN_MSLEEP);
|
||||
return tm.elapsed_m() < timeout_msecs;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user