Module: kamailio
Branch: master
Commit: 2611a4670c65dd32fc1daf6b67e37852936ba69c
URL:
https://github.com/kamailio/kamailio/commit/2611a4670c65dd32fc1daf6b67e3785…
Author: S-P Chan <shihping.chan(a)gmail.com>
Committer: S-P Chan <shihping.chan(a)gmail.com>
Date: 2024-01-30T06:49:21+08:00
db_unixodbc: init libssl in a thread
---
Modified: src/modules/db_unixodbc/dbase.c
---
Diff:
https://github.com/kamailio/kamailio/commit/2611a4670c65dd32fc1daf6b67e3785…
Patch:
https://github.com/kamailio/kamailio/commit/2611a4670c65dd32fc1daf6b67e3785…
---
diff --git a/src/modules/db_unixodbc/dbase.c b/src/modules/db_unixodbc/dbase.c
index eb02b29de50..f3c01b81ee5 100644
--- a/src/modules/db_unixodbc/dbase.c
+++ b/src/modules/db_unixodbc/dbase.c
@@ -22,7 +22,7 @@
*
*/
-
+#include <pthread.h>
#include "../../core/mem/mem.h"
#include "../../core/dprint.h"
#include "../../core/async_task.h"
@@ -227,8 +227,10 @@ extern char *db_unixodbc_tquote;
/*
* Initialize database module
* No function should be called before this
+ *
+ * Init libssl in a thread
*/
-db1_con_t *db_unixodbc_init(const str *_url)
+static db1_con_t *db_unixodbc_init0(const str *_url)
{
db1_con_t *c;
c = db_do_init(_url, (void *)db_unixodbc_new_connection);
@@ -237,6 +239,18 @@ db1_con_t *db_unixodbc_init(const str *_url)
return c;
}
+db1_con_t *db_unixodbc_init(const str *_url)
+{
+ pthread_t tid;
+ db1_con_t *ret;
+
+ pthread_create(
+ &tid, NULL, (void *(*)(void *))db_unixodbc_init0, (void *)_url);
+ pthread_join(tid, (void **)&ret);
+
+ return ret;
+}
+
/*
* Shut down database module
* No function should be called after this