You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-08 14:02:17 +03:00
Fix for CONC-336:
Allow multiple initialization of the client library (mysql_server_init( mysql_server_end). Note: This was already fixed by commit for CONC-277, unfortunately the fix was overwritten by a bad merge.
This commit is contained in:
@@ -3532,6 +3532,7 @@ static void mysql_once_init()
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
static INIT_ONCE init_once = (INIT_ONCE)INIT_ONCE_STATIC_INIT;
|
||||
BOOL CALLBACK win_init_once(
|
||||
PINIT_ONCE InitOnce,
|
||||
PVOID Parameter,
|
||||
@@ -3540,6 +3541,8 @@ BOOL CALLBACK win_init_once(
|
||||
return !mysql_once_init();
|
||||
return TRUE;
|
||||
}
|
||||
#else
|
||||
static pthread_once_t init_once = PTHREAD_ONCE_INIT;
|
||||
#endif
|
||||
|
||||
int STDCALL mysql_server_init(int argc __attribute__((unused)),
|
||||
@@ -3547,11 +3550,9 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)),
|
||||
char **groups __attribute__((unused)))
|
||||
{
|
||||
#ifdef _WIN32
|
||||
static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT;
|
||||
BOOL ret = InitOnceExecuteOnce(&init_once, win_init_once, NULL, NULL);
|
||||
return ret? 0: 1;
|
||||
#else
|
||||
static pthread_once_t init_once = PTHREAD_ONCE_INIT;
|
||||
return pthread_once(&init_once, mysql_once_init);
|
||||
#endif
|
||||
}
|
||||
@@ -3572,6 +3573,11 @@ void STDCALL mysql_server_end(void)
|
||||
#endif
|
||||
mysql_client_init= 0;
|
||||
ma_init_done= 0;
|
||||
#ifdef WIN32
|
||||
init_once = (INIT_ONCE)INIT_ONCE_STATIC_INIT;
|
||||
#else
|
||||
init_once = (pthread_once_t)PTHREAD_ONCE_INIT;
|
||||
#endif
|
||||
}
|
||||
|
||||
my_bool STDCALL mysql_thread_init(void)
|
||||
|
Reference in New Issue
Block a user