[Asterisk-code-review] res pjsip registrar expire: Fix race condition at shutdown. (asterisk[master])

Joshua Colp asteriskteam at digium.com
Thu Apr 7 11:09:01 CDT 2016


Joshua Colp has uploaded a new change for review.

  https://gerrit.asterisk.org/2544

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/44/2544/1

diff --git a/res/res_pjsip_registrar_expire.c b/res/res_pjsip_registrar_expire.c
index 87edf53..e1211be 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/2544
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I69fd239edbaaf160c2d37ae00d3ac06e5596fe8b
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>



More information about the asterisk-code-review mailing list