-
Notifications
You must be signed in to change notification settings - Fork 84
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
Timer is locked and does not work #479
Comments
At a first look your test has a race condition. |
sys_msleep(1000) is added on purpose so that CalledFromOtherThread is called after re_main has started, to indicate that there is a problem with tmr_start. |
to fix this, I'll use mqueue for now. |
#480 is a draft PR |
thank you for figuring this out, I think this could be handled by dummy async event like so: diff --git a/src/main/main.c b/src/main/main.c
index 3584186d..58b76ff7 100644
--- a/src/main/main.c
+++ b/src/main/main.c
@@ -1354,6 +1354,9 @@ void re_thread_leave(void)
}
re_atomic_rlx_set(&re->thread_enter, false);
+ /* Dummy async event, to ensure timers are properly handled */
+ if (re->async)
+ re_thread_async(NULL, NULL, NULL);
re_unlock(re);
} |
Your solution is better. |
when implementing this patch, it turned out that it was not needed, |
The periodic |
The PR is ready, but I'm afraid this fix depends on |
Is your branch up to date? I made the args optional with this commit: 8ca18ff |
Branch update solved the problem. The other thread's timers fire immediately and independently. |
Hi!
The timer does not run if it is started between the re_thread_enter() and re_thread_leave() functions.
Code to reproduce the issue, baresip-webrtc application, calling the CalledFromOtherThread method from another thread:
log output:
As you can see from the logs, ********timeout_handler, tag:0x42, t:700877708 happened after 7 seconds, those only after I made a request to http://192.168.2.156:9000/ in the browser. As I understand poll in re/src/main/main.c:736 received an event and then my timer fired.
I came across this error while trying to test baresip-webrtc with another session initiation protocol. And I found out that repeated peerconnection_new, which is called from another thread, does not trigger peerconnection_gather_handler. Since dns query uses data from query_cache and query_handler is then called via a timer.
Is this a real problem with the timer? Or am I not using baresip correctly with multiple threads?
The text was updated successfully, but these errors were encountered: