[Asterisk-code-review] res pjsip registrar expire: Fix race condition at shutdown. (asterisk[13])
Joshua Colp
asteriskteam at digium.com
Thu Apr 7 11:08:50 CDT 2016
Joshua Colp has uploaded a new change for review.
https://gerrit.asterisk.org/2543
Change subject: res_pjsip_registrar_expire: Fix race condition at shutdown.
......................................................................
res_pjsip_registrar_expire: Fix race condition at shutdown.
When shutting down the PJSIP sorcery is ultimately torn down.
It was possible for the expiration thread to still be running
while this is happening causing a crash.
This change ensures that the thread is shut down before allowing
the module to be considered unloaded.
Change-Id: I69fd239edbaaf160c2d37ae00d3ac06e5596fe8b
---
M res/res_pjsip_registrar_expire.c
1 file changed, 3 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/43/2543/1
diff --git a/res/res_pjsip_registrar_expire.c b/res/res_pjsip_registrar_expire.c
index bdb86e5..41fdaaa 100644
--- a/res/res_pjsip_registrar_expire.c
+++ b/res/res_pjsip_registrar_expire.c
@@ -105,7 +105,10 @@
static int unload_module(void)
{
if (check_thread != AST_PTHREADT_NULL) {
+ check_interval = 0;
pthread_kill(check_thread, SIGURG);
+ pthread_join(check_thread, NULL);
+
check_thread = AST_PTHREADT_NULL;
}
--
To view, visit https://gerrit.asterisk.org/2543
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I69fd239edbaaf160c2d37ae00d3ac06e5596fe8b
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
More information about the asterisk-code-review
mailing list