-
-
Notifications
You must be signed in to change notification settings - Fork 392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unit tests of callback_timer_locked - inconsistence with timer design #954
Comments
I'm wondering if it was considered that a recursive_mutex could be used (this way it won't cause a deadlock), but, I'm not sure how the active_list would work |
I could possibly add member functions that can be used when the execution is within the timer's callback. i.e. These would not check or set the locks. I use something similar in |
My main wondering is this design option:
because, event if is ok to insert, what happens to this loop with things that are inserted in the middle? |
Example: consider there is only 1 single shot time and it will expire. In the callback it calls start (insert) time:
as per this ticket, it is ok if it is assumed it works this way by design (i,e: it is not possible to call timers functions on callback), but then, the unit tests are not ok with this design. |
On the unit tests, timeout of timers:
From test: id2 with a timeout of 10, 111-102 = 9 so it couldn't timeout yet. |
I'm not sure if this would work (with your list) but if this code could be made to start in one front node and only go backwards (leave any eventual new entry on the front) then it would allow new entries and won't remove the delta on new ones. Something like: // only get the last to the beginning from the initial node: this only works if using recursive mutex. |
test_callback_timer_locked.cpp
It tests timer in a way that is not possible to be used.
callback2 calls start() (which has lock/unlock), while callback2 itself is called on a tick() (which is lock too).
This would call a deadlock.
Relates to #952
The text was updated successfully, but these errors were encountered: