Dear all,
Reviewing code in the MMSTimer.c I've seen that the condition to check that the range of ns is valid, should be modified: instead of use a condition, a 'while' should be used.
The code:
Code: |
if(absTime.tv_nsec > 999999999) {
absTime.tv_sec += 1;
absTime.tv_nsec -= 999999999;
}
|
should be replaced by:
Code: |
while (absTime.tv_nsec > 999999999) {
absTime.tv_sec += 1;
absTime.tv_nsec -= 999999999;
}
|
Also, this is not a bug, but an optimization of resources. In the current implementation, a thread is created for each timer. My suggestion is to use a thread with a static queue to dispatch all timers. Each time a timer is started, it is inserted in the static queue to be dispatched by the thread.
Joaquim Duran