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 #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