TimerPool fixoutManipulator

git-svn-id: svn://db.shs.com.ru/pip@70 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
2015-04-07 10:47:59 +00:00
parent ca33c89d95
commit edd3d5f354
3 changed files with 9 additions and 4 deletions

View File

@@ -152,7 +152,7 @@ bool PIBaseTransfer::send_process() {
state_string = "sending"; state_string = "sending";
PITimeMeasurer stm; PITimeMeasurer stm;
send_tm.reset(); send_tm.reset();
int ltm = 0; //int ltm = 0;
for (int i = 0; i < session.size_s(); i++) { for (int i = 0; i < session.size_s(); i++) {
if (send_queue >= packets_count) { if (send_queue >= packets_count) {
--i; --i;

View File

@@ -309,8 +309,10 @@ _PITimerImp_Pool::Pool * _PITimerImp_Pool::Pool::instance() {
void _PITimerImp_Pool::Pool::add(_PITimerImp_Pool * t) { void _PITimerImp_Pool::Pool::add(_PITimerImp_Pool * t) {
//piCout << "add ..."; //piCout << "add ...";
lock(); lock();
if (!timers.contains(t)) if (!timers.contains(t)) {
timers << t; timers << t;
to_remove.removeOne(t);
}
unlock(); unlock();
//piCout << "add done"; //piCout << "add done";
} }
@@ -319,7 +321,7 @@ void _PITimerImp_Pool::Pool::add(_PITimerImp_Pool * t) {
void _PITimerImp_Pool::Pool::remove(_PITimerImp_Pool * t) { void _PITimerImp_Pool::Pool::remove(_PITimerImp_Pool * t) {
//piCout << "remove ..."; //piCout << "remove ...";
lock(); lock();
timers.removeOne(t); to_remove.removeOne(t);
unlock(); unlock();
//piCout << "remove done"; //piCout << "remove done";
} }
@@ -328,6 +330,9 @@ void _PITimerImp_Pool::Pool::remove(_PITimerImp_Pool * t) {
void _PITimerImp_Pool::Pool::run() { void _PITimerImp_Pool::Pool::run() {
piForeach (_PITimerImp_Pool * t, timers) piForeach (_PITimerImp_Pool * t, timers)
t->threadFunc(); t->threadFunc();
piForeach (_PITimerImp_Pool * t, to_remove)
timers.removeOne(t);
to_remove.clear();
//while (t->threadFunc()); //while (t->threadFunc());
} }

View File

@@ -120,7 +120,7 @@ private:
void add(_PITimerImp_Pool * t); void add(_PITimerImp_Pool * t);
void remove(_PITimerImp_Pool * t); void remove(_PITimerImp_Pool * t);
void run(); void run();
PIVector<_PITimerImp_Pool * > timers; PIVector<_PITimerImp_Pool * > timers, to_remove;
}; };
virtual bool startTimer(double interval_ms); virtual bool startTimer(double interval_ms);
virtual bool stopTimer(); virtual bool stopTimer();