diff --git a/src/io/pibasetransfer.cpp b/src/io/pibasetransfer.cpp index db342d1c..8e2c846f 100644 --- a/src/io/pibasetransfer.cpp +++ b/src/io/pibasetransfer.cpp @@ -152,7 +152,7 @@ bool PIBaseTransfer::send_process() { state_string = "sending"; PITimeMeasurer stm; send_tm.reset(); - int ltm = 0; + //int ltm = 0; for (int i = 0; i < session.size_s(); i++) { if (send_queue >= packets_count) { --i; diff --git a/src/thread/pitimer.cpp b/src/thread/pitimer.cpp index 6a640d49..f0731358 100755 --- a/src/thread/pitimer.cpp +++ b/src/thread/pitimer.cpp @@ -309,8 +309,10 @@ _PITimerImp_Pool::Pool * _PITimerImp_Pool::Pool::instance() { void _PITimerImp_Pool::Pool::add(_PITimerImp_Pool * t) { //piCout << "add ..."; lock(); - if (!timers.contains(t)) + if (!timers.contains(t)) { timers << t; + to_remove.removeOne(t); + } unlock(); //piCout << "add done"; } @@ -319,7 +321,7 @@ void _PITimerImp_Pool::Pool::add(_PITimerImp_Pool * t) { void _PITimerImp_Pool::Pool::remove(_PITimerImp_Pool * t) { //piCout << "remove ..."; lock(); - timers.removeOne(t); + to_remove.removeOne(t); unlock(); //piCout << "remove done"; } @@ -328,6 +330,9 @@ void _PITimerImp_Pool::Pool::remove(_PITimerImp_Pool * t) { void _PITimerImp_Pool::Pool::run() { piForeach (_PITimerImp_Pool * t, timers) t->threadFunc(); + piForeach (_PITimerImp_Pool * t, to_remove) + timers.removeOne(t); + to_remove.clear(); //while (t->threadFunc()); } diff --git a/src/thread/pitimer.h b/src/thread/pitimer.h index a0a07dcb..78bf68a1 100755 --- a/src/thread/pitimer.h +++ b/src/thread/pitimer.h @@ -120,7 +120,7 @@ private: void add(_PITimerImp_Pool * t); void remove(_PITimerImp_Pool * t); void run(); - PIVector<_PITimerImp_Pool * > timers; + PIVector<_PITimerImp_Pool * > timers, to_remove; }; virtual bool startTimer(double interval_ms); virtual bool stopTimer();