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
|
#ifdef _WIN32
|
||||||
|
static INIT_ONCE init_once = (INIT_ONCE)INIT_ONCE_STATIC_INIT;
|
||||||
BOOL CALLBACK win_init_once(
|
BOOL CALLBACK win_init_once(
|
||||||
PINIT_ONCE InitOnce,
|
PINIT_ONCE InitOnce,
|
||||||
PVOID Parameter,
|
PVOID Parameter,
|
||||||
@@ -3540,6 +3541,8 @@ BOOL CALLBACK win_init_once(
|
|||||||
return !mysql_once_init();
|
return !mysql_once_init();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
static pthread_once_t init_once = PTHREAD_ONCE_INIT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int STDCALL mysql_server_init(int argc __attribute__((unused)),
|
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)))
|
char **groups __attribute__((unused)))
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT;
|
|
||||||
BOOL ret = InitOnceExecuteOnce(&init_once, win_init_once, NULL, NULL);
|
BOOL ret = InitOnceExecuteOnce(&init_once, win_init_once, NULL, NULL);
|
||||||
return ret? 0: 1;
|
return ret? 0: 1;
|
||||||
#else
|
#else
|
||||||
static pthread_once_t init_once = PTHREAD_ONCE_INIT;
|
|
||||||
return pthread_once(&init_once, mysql_once_init);
|
return pthread_once(&init_once, mysql_once_init);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -3572,6 +3573,11 @@ void STDCALL mysql_server_end(void)
|
|||||||
#endif
|
#endif
|
||||||
mysql_client_init= 0;
|
mysql_client_init= 0;
|
||||||
ma_init_done= 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)
|
my_bool STDCALL mysql_thread_init(void)
|
||||||
|
@@ -26,7 +26,7 @@ INCLUDE_DIRECTORIES(${CC_SOURCE_DIR}/include
|
|||||||
${CC_SOURCE_DIR}/unittest/libmariadb)
|
${CC_SOURCE_DIR}/unittest/libmariadb)
|
||||||
ADD_DEFINITIONS(-DLIBMARIADB)
|
ADD_DEFINITIONS(-DLIBMARIADB)
|
||||||
|
|
||||||
SET(API_TESTS "bulk1" "performance" "basic-t" "fetch" "charset" "logs" "cursor" "errors" "view" "ps" "ps_bugs" "sp" "result" "connection" "misc" "ps_new" "thread" "features-10_2" "bulk1")
|
SET(API_TESTS "conc336" "bulk1" "performance" "basic-t" "fetch" "charset" "logs" "cursor" "errors" "view" "ps" "ps_bugs" "sp" "result" "connection" "misc" "ps_new" "thread" "features-10_2" "bulk1")
|
||||||
IF(WITH_DYNCOL)
|
IF(WITH_DYNCOL)
|
||||||
SET(API_TESTS ${API_TESTS} "dyncol")
|
SET(API_TESTS ${API_TESTS} "dyncol")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
Reference in New Issue
Block a user