[Asterisk-code-review] res_config_sqlite3: Only join threads that we started (...asterisk[13])

Sean Bright asteriskteam at digium.com
Tue Jul 23 13:10:05 CDT 2019


Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/11618


Change subject: res_config_sqlite3: Only join threads that we started
......................................................................

res_config_sqlite3: Only join threads that we started

ASTERISK-28477 #close
Reported by: Dennis

ASTERISK-28478 #close
Reported by: Dennis

Change-Id: I77347ad46a86dc5b35ed68270cee56acefb4f475
---
M res/res_config_sqlite3.c
1 file changed, 4 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/18/11618/1

diff --git a/res/res_config_sqlite3.c b/res/res_config_sqlite3.c
index 6148d5d..d321cb7 100644
--- a/res/res_config_sqlite3.c
+++ b/res/res_config_sqlite3.c
@@ -104,6 +104,7 @@
 	unsigned int debug:1;
 	unsigned int exiting:1;
 	unsigned int wakeup:1;
+	unsigned int has_batch_thread:1;
 	unsigned int batch;
 };
 
@@ -368,13 +369,14 @@
 	if (db->batch) {
 		ast_cond_init(&db->cond, NULL);
 		ao2_ref(db, +1);
-		ast_pthread_create_background(&db->syncthread, NULL, db_sync_thread, db);
+		db->has_batch_thread = !ast_pthread_create_background(&db->syncthread, NULL, db_sync_thread, db);
 	}
 }
 
 void db_stop_batch(struct realtime_sqlite3_db *db)
 {
-	if (db->batch) {
+	if (db->has_batch_thread) {
+		db->has_batch_thread = 0;
 		db->exiting = 1;
 		db_sync(db);
 		pthread_join(db->syncthread, NULL);

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/11618
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I77347ad46a86dc5b35ed68270cee56acefb4f475
Gerrit-Change-Number: 11618
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190723/e8f529b5/attachment-0001.html>


More information about the asterisk-code-review mailing list