C API Threaded Function Descriptions

You need to use the following functions when you want to create a threaded client. See Threaded clients.

Description

This function needs to be called once in the program before calling any MySQL function. This initializes some global variables that MySQL needs. If you are using a thread-safe client library, this will also call mysql_thread_init() for this thread.

This is automatically called by mysql_init(), mysql_server_init() and mysql_connect().

Return Values

None.

Description

This function needs to be called for each created thread to initialize thread-specific variables.

This is automatically called by my_init() and mysql_connect().

Return Values

Zero if successful. Non-zero if an error occurred.

Description

This function needs to be called before calling pthread_exit() to free memory allocated by mysql_thread_init().

Note that this function is not invoked automatically by the client library. It must be called explicitly to avoid a memory leak.

Return Values

None.

Description

This function indicates whether the client is compiled as thread-safe.

Return Values

1 is the client is thread-safe, 0 otherwise.

my_init()

void my_init(void)

mysql_thread_init()

my_bool mysql_thread_init(void)

mysql_thread_end()

void mysql_thread_end(void)

mysql_thread_safe()

unsigned int mysql_thread_safe(void)