Commit 0f60474f authored by unknown's avatar unknown

pthread_handler_decl() changed to be ctags-friendly

(and contain extern "C" when necessary)

parent 970150d1
...@@ -33,7 +33,7 @@ typedef CRITICAL_SECTION pthread_mutex_t; ...@@ -33,7 +33,7 @@ typedef CRITICAL_SECTION pthread_mutex_t;
#define pthread_mutex_lock(A) (EnterCriticalSection(A),0) #define pthread_mutex_lock(A) (EnterCriticalSection(A),0)
#define pthread_mutex_unlock(A) LeaveCriticalSection(A) #define pthread_mutex_unlock(A) LeaveCriticalSection(A)
#define pthread_mutex_destroy(A) DeleteCriticalSection(A) #define pthread_mutex_destroy(A) DeleteCriticalSection(A)
#define pthread_handler_decl(A,B) unsigned __cdecl A(void *B) #define pthread_handler_t unsigned __cdecl *
typedef unsigned (__cdecl *pthread_handler)(void *); typedef unsigned (__cdecl *pthread_handler)(void *);
#define pthread_self() GetCurrentThread() #define pthread_self() GetCurrentThread()
...@@ -155,7 +155,7 @@ int _my_errno(void) ...@@ -155,7 +155,7 @@ int _my_errno(void)
** The test program ** The test program
*****************************************************************************/ *****************************************************************************/
pthread_handler_decl(test_thread,arg) pthread_handler_t test_thread(void *arg)
{ {
MYSQL mysql; MYSQL mysql;
MYSQL_RES *res; MYSQL_RES *res;
......
...@@ -44,7 +44,7 @@ typedef CRITICAL_SECTION pthread_mutex_t; ...@@ -44,7 +44,7 @@ typedef CRITICAL_SECTION pthread_mutex_t;
#define pthread_mutex_lock(A) (EnterCriticalSection(A),0) #define pthread_mutex_lock(A) (EnterCriticalSection(A),0)
#define pthread_mutex_unlock(A) LeaveCriticalSection(A) #define pthread_mutex_unlock(A) LeaveCriticalSection(A)
#define pthread_mutex_destroy(A) DeleteCriticalSection(A) #define pthread_mutex_destroy(A) DeleteCriticalSection(A)
#define pthread_handler_decl(A,B) unsigned __cdecl A(void *B) #define pthread_handler_t unsigned __cdecl *
typedef unsigned (__cdecl *pthread_handler)(void *); typedef unsigned (__cdecl *pthread_handler)(void *);
#define pthread_self() GetCurrentThread() #define pthread_self() GetCurrentThread()
...@@ -174,7 +174,7 @@ int _my_errno(void) ...@@ -174,7 +174,7 @@ int _my_errno(void)
** The test program ** The test program
*****************************************************************************/ *****************************************************************************/
pthread_handler_decl(test_thread,arg) pthread_handler_t test_thread(void *arg)
{ {
pthread_mutex_lock(&LOCK_thread_count); pthread_mutex_lock(&LOCK_thread_count);
thread_count--; thread_count--;
......
...@@ -25,7 +25,10 @@ ...@@ -25,7 +25,10 @@
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
#define EXTERN_C extern "C"
extern "C" { extern "C" {
#else
#define EXTERN_C
#endif /* __cplusplus */ #endif /* __cplusplus */
#if defined(__WIN__) || defined(OS2) #if defined(__WIN__) || defined(OS2)
...@@ -77,10 +80,10 @@ struct timespec { /* For pthread_cond_timedwait() */ ...@@ -77,10 +80,10 @@ struct timespec { /* For pthread_cond_timedwait() */
typedef int pthread_mutexattr_t; typedef int pthread_mutexattr_t;
#define win_pthread_self my_thread_var->pthread_self #define win_pthread_self my_thread_var->pthread_self
#ifdef OS2 #ifdef OS2
#define pthread_handler_decl(A,B) void * _Optlink A(void *B) #define pthread_handler_t EXTERN_C void * _Optlink
typedef void * (_Optlink *pthread_handler)(void *); typedef void * (_Optlink *pthread_handler)(void *);
#else #else
#define pthread_handler_decl(A,B) void * __cdecl A(void *B) #define pthread_handler_t EXTERN_C void * __cdecl
typedef void * (__cdecl *pthread_handler)(void *); typedef void * (__cdecl *pthread_handler)(void *);
#endif #endif
...@@ -184,7 +187,7 @@ typedef int pthread_attr_t; /* Needed by Unixware 7.0.0 */ ...@@ -184,7 +187,7 @@ typedef int pthread_attr_t; /* Needed by Unixware 7.0.0 */
#define pthread_key_create(A,B) thr_keycreate((A),(B)) #define pthread_key_create(A,B) thr_keycreate((A),(B))
#define pthread_key_delete(A) thr_keydelete(A) #define pthread_key_delete(A) thr_keydelete(A)
#define pthread_handler_decl(A,B) void *A(void *B) #define pthread_handler_t EXTERN_C void *
#define pthread_key(T,V) pthread_key_t V #define pthread_key(T,V) pthread_key_t V
void * my_pthread_getspecific_imp(pthread_key_t key); void * my_pthread_getspecific_imp(pthread_key_t key);
...@@ -262,7 +265,7 @@ extern int my_pthread_getprio(pthread_t thread_id); ...@@ -262,7 +265,7 @@ extern int my_pthread_getprio(pthread_t thread_id);
#define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,(V)) #define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,(V))
#define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,(void*) (V)) #define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,(void*) (V))
#define pthread_detach_this_thread() #define pthread_detach_this_thread()
#define pthread_handler_decl(A,B) void *A(void *B) #define pthread_handler_t EXTERN_C void *
typedef void *(* pthread_handler)(void *); typedef void *(* pthread_handler)(void *);
/* Test first for RTS or FSU threads */ /* Test first for RTS or FSU threads */
......
...@@ -728,7 +728,7 @@ int flush_pending_blocks(MI_SORT_PARAM *param); ...@@ -728,7 +728,7 @@ int flush_pending_blocks(MI_SORT_PARAM *param);
int sort_ft_buf_flush(MI_SORT_PARAM *sort_param); int sort_ft_buf_flush(MI_SORT_PARAM *sort_param);
int thr_write_keys(MI_SORT_PARAM *sort_param); int thr_write_keys(MI_SORT_PARAM *sort_param);
#ifdef THREAD #ifdef THREAD
pthread_handler_decl(thr_find_all_keys,arg); pthread_handler_t thr_find_all_keys(void *arg);
#endif #endif
int flush_blocks(MI_CHECK *param, KEY_CACHE *key_cache, File file); int flush_blocks(MI_CHECK *param, KEY_CACHE *key_cache, File file);
......
...@@ -307,7 +307,7 @@ static ha_rows NEAR_F find_all_keys(MI_SORT_PARAM *info, uint keys, ...@@ -307,7 +307,7 @@ static ha_rows NEAR_F find_all_keys(MI_SORT_PARAM *info, uint keys,
#ifdef THREAD #ifdef THREAD
/* Search after all keys and place them in a temp. file */ /* Search after all keys and place them in a temp. file */
pthread_handler_decl(thr_find_all_keys,arg) pthread_handler_t thr_find_all_keys(void *arg)
{ {
MI_SORT_PARAM *info= (MI_SORT_PARAM*) arg; MI_SORT_PARAM *info= (MI_SORT_PARAM*) arg;
int error; int error;
......
...@@ -51,7 +51,7 @@ void win_pthread_init(void) ...@@ -51,7 +51,7 @@ void win_pthread_init(void)
** in the new thread. ** in the new thread.
*/ */
static pthread_handler_decl(pthread_start,param) pthread_handler_t pthread_start(void *param)
{ {
DBUG_ENTER("pthread_start"); DBUG_ENTER("pthread_start");
pthread_handler func=((struct pthread_map *) param)->func; pthread_handler func=((struct pthread_map *) param)->func;
......
...@@ -51,7 +51,7 @@ void win_pthread_init(void) ...@@ -51,7 +51,7 @@ void win_pthread_init(void)
** in the new thread. ** in the new thread.
*/ */
static pthread_handler_decl(pthread_start,param) pthread_handler_t pthread_start(void *param)
{ {
pthread_handler func=((struct pthread_map *) param)->func; pthread_handler func=((struct pthread_map *) param)->func;
void *func_param=((struct pthread_map *) param)->param; void *func_param=((struct pthread_map *) param)->param;
......
...@@ -86,7 +86,7 @@ const char *Ndb_cluster_connection::get_connectstring(char *buf, ...@@ -86,7 +86,7 @@ const char *Ndb_cluster_connection::get_connectstring(char *buf,
return 0; return 0;
} }
extern "C" pthread_handler_decl(run_ndb_cluster_connection_connect_thread, me) pthread_handler_t run_ndb_cluster_connection_connect_thread(void *me)
{ {
g_run_connect_thread= 1; g_run_connect_thread= 1;
((Ndb_cluster_connection_impl*) me)->connect_thread(); ((Ndb_cluster_connection_impl*) me)->connect_thread();
......
...@@ -33,18 +33,13 @@ ...@@ -33,18 +33,13 @@
C_MODE_START pthread_handler_t guardian(void *arg)
pthread_handler_decl(guardian, arg)
{ {
Guardian_thread *guardian_thread= (Guardian_thread *) arg; Guardian_thread *guardian_thread= (Guardian_thread *) arg;
guardian_thread->run(); guardian_thread->run();
return 0; return 0;
} }
C_MODE_END
Guardian_thread::Guardian_thread(Thread_registry &thread_registry_arg, Guardian_thread::Guardian_thread(Thread_registry &thread_registry_arg,
Instance_map *instance_map_arg, Instance_map *instance_map_arg,
uint monitoring_interval_arg) : uint monitoring_interval_arg) :
......
...@@ -31,11 +31,7 @@ class Instance_map; ...@@ -31,11 +31,7 @@ class Instance_map;
class Thread_registry; class Thread_registry;
struct GUARD_NODE; struct GUARD_NODE;
C_MODE_START pthread_handler_t guardian(void *arg);
pthread_handler_decl(guardian, arg);
C_MODE_END
struct Guardian_thread_args struct Guardian_thread_args
{ {
......
...@@ -43,8 +43,6 @@ typedef pid_t My_process_info; ...@@ -43,8 +43,6 @@ typedef pid_t My_process_info;
typedef PROCESS_INFORMATION My_process_info; typedef PROCESS_INFORMATION My_process_info;
#endif #endif
C_MODE_START
/* /*
Proxy thread is a simple way to avoid all pitfalls of the threads Proxy thread is a simple way to avoid all pitfalls of the threads
implementation in the OS (e.g. LinuxThreads). With such a thread we implementation in the OS (e.g. LinuxThreads). With such a thread we
...@@ -52,7 +50,7 @@ C_MODE_START ...@@ -52,7 +50,7 @@ C_MODE_START
to do it in a portable way. to do it in a portable way.
*/ */
pthread_handler_decl(proxy, arg) pthread_handler_t proxy(void *arg)
{ {
Instance *instance= (Instance *) arg; Instance *instance= (Instance *) arg;
start_and_monitor_instance(&instance->options, start_and_monitor_instance(&instance->options,
...@@ -60,9 +58,6 @@ pthread_handler_decl(proxy, arg) ...@@ -60,9 +58,6 @@ pthread_handler_decl(proxy, arg)
return 0; return 0;
} }
C_MODE_END
/* /*
Wait for an instance Wait for an instance
......
...@@ -372,10 +372,7 @@ void Listener_thread::handle_new_mysql_connection(Vio *vio) ...@@ -372,10 +372,7 @@ void Listener_thread::handle_new_mysql_connection(Vio *vio)
} }
C_MODE_START pthread_handler_t listener(void *arg)
pthread_handler_decl(listener, arg)
{ {
Listener_thread_args *args= (Listener_thread_args *) arg; Listener_thread_args *args= (Listener_thread_args *) arg;
Listener_thread listener(*args); Listener_thread listener(*args);
...@@ -387,6 +384,3 @@ pthread_handler_decl(listener, arg) ...@@ -387,6 +384,3 @@ pthread_handler_decl(listener, arg)
return 0; return 0;
} }
C_MODE_END
...@@ -24,11 +24,7 @@ ...@@ -24,11 +24,7 @@
#include <my_pthread.h> #include <my_pthread.h>
C_MODE_START pthread_handler_t listener(void *arg);
pthread_handler_decl(listener, arg);
C_MODE_END
class Thread_registry; class Thread_registry;
struct Options; struct Options;
......
...@@ -364,9 +364,7 @@ int Mysql_connection_thread::dispatch_command(enum enum_server_command command, ...@@ -364,9 +364,7 @@ int Mysql_connection_thread::dispatch_command(enum enum_server_command command,
} }
C_MODE_START pthread_handler_t mysql_connection(void *arg)
pthread_handler_decl(mysql_connection, arg)
{ {
Mysql_connection_thread_args *args= (Mysql_connection_thread_args *) arg; Mysql_connection_thread_args *args= (Mysql_connection_thread_args *) arg;
Mysql_connection_thread mysql_connection_thread(*args); Mysql_connection_thread mysql_connection_thread(*args);
...@@ -381,9 +379,6 @@ pthread_handler_decl(mysql_connection, arg) ...@@ -381,9 +379,6 @@ pthread_handler_decl(mysql_connection, arg)
return 0; return 0;
} }
C_MODE_END
/* /*
vim: fdm=marker vim: fdm=marker
*/ */
...@@ -24,12 +24,7 @@ ...@@ -24,12 +24,7 @@
#include <my_pthread.h> #include <my_pthread.h>
C_MODE_START pthread_handler_t mysql_connection(void *arg);
pthread_handler_decl(mysql_connection, arg);
C_MODE_END
class Thread_registry; class Thread_registry;
class User_map; class User_map;
......
...@@ -121,7 +121,7 @@ static int ndb_get_table_statistics(Ndb*, const char *, ...@@ -121,7 +121,7 @@ static int ndb_get_table_statistics(Ndb*, const char *,
static pthread_t ndb_util_thread; static pthread_t ndb_util_thread;
pthread_mutex_t LOCK_ndb_util_thread; pthread_mutex_t LOCK_ndb_util_thread;
pthread_cond_t COND_ndb_util_thread; pthread_cond_t COND_ndb_util_thread;
extern "C" pthread_handler_decl(ndb_util_thread_func, arg); pthread_handler_t ndb_util_thread_func(void *arg);
ulong ndb_cache_check_time; ulong ndb_cache_check_time;
/* /*
...@@ -5926,8 +5926,7 @@ ha_ndbcluster::update_table_comment( ...@@ -5926,8 +5926,7 @@ ha_ndbcluster::update_table_comment(
// Utility thread main loop // Utility thread main loop
extern "C" pthread_handler_decl(ndb_util_thread_func, pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused)))
arg __attribute__((unused)))
{ {
THD *thd; /* needs to be first for thread_stack */ THD *thd; /* needs to be first for thread_stack */
Ndb* ndb; Ndb* ndb;
......
...@@ -610,8 +610,8 @@ bool multi_delete_set_locks_and_link_aux_tables(LEX *lex); ...@@ -610,8 +610,8 @@ bool multi_delete_set_locks_and_link_aux_tables(LEX *lex);
void init_max_user_conn(void); void init_max_user_conn(void);
void init_update_queries(void); void init_update_queries(void);
void free_max_user_conn(void); void free_max_user_conn(void);
extern "C" pthread_handler_decl(handle_one_connection,arg); pthread_handler_t handle_one_connection(void *arg);
extern "C" pthread_handler_decl(handle_bootstrap,arg); pthread_handler_t handle_bootstrap(void *arg);
void end_thread(THD *thd,bool put_in_cache); void end_thread(THD *thd,bool put_in_cache);
void flush_thread_cache(); void flush_thread_cache();
bool mysql_execute_command(THD *thd); bool mysql_execute_command(THD *thd);
...@@ -1035,7 +1035,7 @@ int write_record(THD *thd, TABLE *table, COPY_INFO *info); ...@@ -1035,7 +1035,7 @@ int write_record(THD *thd, TABLE *table, COPY_INFO *info);
extern ulong volatile manager_status; extern ulong volatile manager_status;
extern bool volatile manager_thread_in_use, mqh_used; extern bool volatile manager_thread_in_use, mqh_used;
extern pthread_t manager_thread; extern pthread_t manager_thread;
extern "C" pthread_handler_decl(handle_manager, arg); pthread_handler_t handle_manager(void *arg);
/* sql_test.cc */ /* sql_test.cc */
#ifndef DBUG_OFF #ifndef DBUG_OFF
......
...@@ -587,25 +587,25 @@ struct st_VioSSLAcceptorFd *ssl_acceptor_fd; ...@@ -587,25 +587,25 @@ struct st_VioSSLAcceptorFd *ssl_acceptor_fd;
/* Function declarations */ /* Function declarations */
static void start_signal_handler(void); static void start_signal_handler(void);
static pthread_handler_decl(signal_hand, arg); pthread_handler_t signal_hand(void *arg);
static void mysql_init_variables(void); static void mysql_init_variables(void);
static void get_options(int argc,char **argv); static void get_options(int argc,char **argv);
static void set_server_version(void); static void set_server_version(void);
static int init_thread_environment(); static int init_thread_environment();
static char *get_relative_path(const char *path); static char *get_relative_path(const char *path);
static void fix_paths(void); static void fix_paths(void);
extern "C" pthread_handler_decl(handle_connections_sockets,arg); pthread_handler_t handle_connections_sockets(void *arg);
extern "C" pthread_handler_decl(kill_server_thread,arg); pthread_handler_t kill_server_thread(void *arg);
static void bootstrap(FILE *file); static void bootstrap(FILE *file);
static void close_server_sock(); static void close_server_sock();
static bool read_init_file(char *file_name); static bool read_init_file(char *file_name);
#ifdef __NT__ #ifdef __NT__
extern "C" pthread_handler_decl(handle_connections_namedpipes,arg); pthread_handler_t handle_connections_namedpipes(void *arg);
#endif #endif
#ifdef HAVE_SMEM #ifdef HAVE_SMEM
static pthread_handler_decl(handle_connections_shared_memory,arg); pthread_handler_t handle_connections_shared_memory(void *arg);
#endif #endif
extern "C" pthread_handler_decl(handle_slave,arg); pthread_handler_t handle_slave(void *arg);
static ulong find_bit_type(const char *x, TYPELIB *bit_lib); static ulong find_bit_type(const char *x, TYPELIB *bit_lib);
static void clean_up(bool print_message); static void clean_up(bool print_message);
static void clean_up_mutexes(void); static void clean_up_mutexes(void);
...@@ -954,7 +954,7 @@ static void __cdecl kill_server(int sig_ptr) ...@@ -954,7 +954,7 @@ static void __cdecl kill_server(int sig_ptr)
#if defined(USE_ONE_SIGNAL_HAND) || (defined(__NETWARE__) && defined(SIGNALS_DONT_BREAK_READ)) #if defined(USE_ONE_SIGNAL_HAND) || (defined(__NETWARE__) && defined(SIGNALS_DONT_BREAK_READ))
extern "C" pthread_handler_decl(kill_server_thread,arg __attribute__((unused))) pthread_handler_t kill_server_thread(void *arg __attribute__((unused)))
{ {
my_thread_init(); // Initialize new thread my_thread_init(); // Initialize new thread
kill_server(0); kill_server(0);
...@@ -2388,7 +2388,7 @@ int uname(struct utsname *a) ...@@ -2388,7 +2388,7 @@ int uname(struct utsname *a)
} }
extern "C" pthread_handler_decl(handle_shutdown,arg) pthread_handler_t handle_shutdown(void *arg)
{ {
MSG msg; MSG msg;
my_thread_init(); my_thread_init();
...@@ -2417,7 +2417,7 @@ int STDCALL handle_kill(ulong ctrl_type) ...@@ -2417,7 +2417,7 @@ int STDCALL handle_kill(ulong ctrl_type)
#ifdef OS2 #ifdef OS2
extern "C" pthread_handler_decl(handle_shutdown,arg) pthread_handler_t handle_shutdown(void *arg)
{ {
my_thread_init(); my_thread_init();
...@@ -3731,8 +3731,7 @@ inline void kill_broken_server() ...@@ -3731,8 +3731,7 @@ inline void kill_broken_server()
/* Handle new connections and spawn new process to handle them */ /* Handle new connections and spawn new process to handle them */
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
extern "C" pthread_handler_decl(handle_connections_sockets, pthread_handler_t handle_connections_sockets(void *arg __attribute__((unused)))
arg __attribute__((unused)))
{ {
my_socket sock,new_sock; my_socket sock,new_sock;
uint error_count=0; uint error_count=0;
...@@ -3946,7 +3945,7 @@ extern "C" pthread_handler_decl(handle_connections_sockets, ...@@ -3946,7 +3945,7 @@ extern "C" pthread_handler_decl(handle_connections_sockets,
#ifdef __NT__ #ifdef __NT__
extern "C" pthread_handler_decl(handle_connections_namedpipes,arg) pthread_handler_t handle_connections_namedpipes(void *arg)
{ {
HANDLE hConnectedPipe; HANDLE hConnectedPipe;
BOOL fConnected; BOOL fConnected;
...@@ -4032,17 +4031,16 @@ extern "C" pthread_handler_decl(handle_connections_namedpipes,arg) ...@@ -4032,17 +4031,16 @@ extern "C" pthread_handler_decl(handle_connections_namedpipes,arg)
Thread of shared memory's service Thread of shared memory's service
SYNOPSIS SYNOPSIS
pthread_handler_decl() handle_connections_shared_memory()
handle_connections_shared_memory Thread handle
arg Arguments of thread arg Arguments of thread
*/ */
#ifdef HAVE_SMEM #ifdef HAVE_SMEM
pthread_handler_decl(handle_connections_shared_memory,arg) pthread_handler_t handle_connections_shared_memory(void *arg)
{ {
/* file-mapping object, use for create shared memory */ /* file-mapping object, use for create shared memory */
HANDLE handle_connect_file_map= 0; HANDLE handle_connect_file_map= 0;
char *handle_connect_map= 0; // pointer on shared memory char *handle_connect_map= 0; // pointer on shared memory
HANDLE event_connect_answer= 0; HANDLE event_connect_answer= 0;
ulong smem_buffer_length= shared_memory_buffer_length + 4; ulong smem_buffer_length= shared_memory_buffer_length + 4;
ulong connect_number= 1; ulong connect_number= 1;
......
...@@ -578,7 +578,7 @@ int find_recovery_captain(THD* thd, MYSQL* mysql) ...@@ -578,7 +578,7 @@ int find_recovery_captain(THD* thd, MYSQL* mysql)
} }
pthread_handler_decl(handle_failsafe_rpl,arg) pthread_handler_t handle_failsafe_rpl(void *arg)
{ {
DBUG_ENTER("handle_failsafe_rpl"); DBUG_ENTER("handle_failsafe_rpl");
THD *thd = new THD; THD *thd = new THD;
......
...@@ -31,7 +31,7 @@ extern pthread_cond_t COND_rpl_status; ...@@ -31,7 +31,7 @@ extern pthread_cond_t COND_rpl_status;
extern TYPELIB rpl_role_typelib, rpl_status_typelib; extern TYPELIB rpl_role_typelib, rpl_status_typelib;
extern const char* rpl_role_type[], *rpl_status_type[]; extern const char* rpl_role_type[], *rpl_status_type[];
pthread_handler_decl(handle_failsafe_rpl,arg); pthread_handler_t handle_failsafe_rpl(void *arg);
void change_rpl_status(RPL_STATUS from_status, RPL_STATUS to_status); void change_rpl_status(RPL_STATUS from_status, RPL_STATUS to_status);
int find_recovery_captain(THD* thd, MYSQL* mysql); int find_recovery_captain(THD* thd, MYSQL* mysql);
int update_slave_list(MYSQL* mysql, MASTER_INFO* mi); int update_slave_list(MYSQL* mysql, MASTER_INFO* mi);
......
...@@ -3325,7 +3325,7 @@ on this slave.\ ...@@ -3325,7 +3325,7 @@ on this slave.\
/* Slave I/O Thread entry point */ /* Slave I/O Thread entry point */
extern "C" pthread_handler_decl(handle_slave_io,arg) pthread_handler_t handle_slave_io(void *arg)
{ {
THD *thd; // needs to be first for thread_stack THD *thd; // needs to be first for thread_stack
MYSQL *mysql; MYSQL *mysql;
...@@ -3634,7 +3634,7 @@ log space"); ...@@ -3634,7 +3634,7 @@ log space");
#ifndef DBUG_OFF #ifndef DBUG_OFF
if (abort_slave_event_count && !events_till_abort) if (abort_slave_event_count && !events_till_abort)
goto slave_begin; goto slave_begin;
#endif #endif
my_thread_end(); my_thread_end();
pthread_exit(0); pthread_exit(0);
DBUG_RETURN(0); // Can't return anything here DBUG_RETURN(0); // Can't return anything here
...@@ -3643,11 +3643,11 @@ log space"); ...@@ -3643,11 +3643,11 @@ log space");
/* Slave SQL Thread entry point */ /* Slave SQL Thread entry point */
extern "C" pthread_handler_decl(handle_slave_sql,arg) pthread_handler_t handle_slave_sql(void *arg)
{ {
THD *thd; /* needs to be first for thread_stack */ THD *thd; /* needs to be first for thread_stack */
char llbuff[22],llbuff1[22]; char llbuff[22],llbuff1[22];
RELAY_LOG_INFO* rli = &((MASTER_INFO*)arg)->rli; RELAY_LOG_INFO* rli = &((MASTER_INFO*)arg)->rli;
const char *errmsg; const char *errmsg;
// needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff // needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff
...@@ -3655,7 +3655,7 @@ extern "C" pthread_handler_decl(handle_slave_sql,arg) ...@@ -3655,7 +3655,7 @@ extern "C" pthread_handler_decl(handle_slave_sql,arg)
DBUG_ENTER("handle_slave_sql"); DBUG_ENTER("handle_slave_sql");
#ifndef DBUG_OFF #ifndef DBUG_OFF
slave_begin: slave_begin:
#endif #endif
DBUG_ASSERT(rli->inited); DBUG_ASSERT(rli->inited);
......
...@@ -572,8 +572,8 @@ void set_slave_thread_options(THD* thd); ...@@ -572,8 +572,8 @@ void set_slave_thread_options(THD* thd);
void set_slave_thread_default_charset(THD* thd, RELAY_LOG_INFO *rli); void set_slave_thread_default_charset(THD* thd, RELAY_LOG_INFO *rli);
void rotate_relay_log(MASTER_INFO* mi); void rotate_relay_log(MASTER_INFO* mi);
extern "C" pthread_handler_decl(handle_slave_io,arg); pthread_handler_t handle_slave_io(void *arg);
extern "C" pthread_handler_decl(handle_slave_sql,arg); pthread_handler_t handle_slave_sql(void *arg);
extern bool volatile abort_loop; extern bool volatile abort_loop;
extern MASTER_INFO main_mi, *active_mi; /* active_mi for multi-master */ extern MASTER_INFO main_mi, *active_mi; /* active_mi for multi-master */
extern LIST master_list; extern LIST master_list;
......
...@@ -1146,8 +1146,8 @@ class THD :public Statement, ...@@ -1146,8 +1146,8 @@ class THD :public Statement,
thread is (and must remain, for now) the only responsible for freeing these thread is (and must remain, for now) the only responsible for freeing these
3 members. If you add members here, and you add code to set them in 3 members. If you add members here, and you add code to set them in
replication, don't forget to free_them_and_set_them_to_0 in replication replication, don't forget to free_them_and_set_them_to_0 in replication
properly. For details see the 'err:' label of the pthread_handler_decl of properly. For details see the 'err:' label of the handle_slave_sql()
the slave SQL thread, in sql/slave.cc. in sql/slave.cc.
*/ */
char *db, *catalog; char *db, *catalog;
Security_context main_security_ctx; Security_context main_security_ctx;
......
...@@ -28,7 +28,7 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list); ...@@ -28,7 +28,7 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list);
static int write_delayed(THD *thd,TABLE *table, enum_duplicates dup, bool ignore, static int write_delayed(THD *thd,TABLE *table, enum_duplicates dup, bool ignore,
char *query, uint query_length, bool log_on); char *query, uint query_length, bool log_on);
static void end_delayed_insert(THD *thd); static void end_delayed_insert(THD *thd);
extern "C" pthread_handler_decl(handle_delayed_insert,arg); pthread_handler_t handle_delayed_insert(void *arg);
static void unlink_blobs(register TABLE *table); static void unlink_blobs(register TABLE *table);
#endif #endif
static bool check_view_insertability(THD *thd, TABLE_LIST *view); static bool check_view_insertability(THD *thd, TABLE_LIST *view);
...@@ -1691,7 +1691,7 @@ void kill_delayed_threads(void) ...@@ -1691,7 +1691,7 @@ void kill_delayed_threads(void)
* Create a new delayed insert thread * Create a new delayed insert thread
*/ */
extern "C" pthread_handler_decl(handle_delayed_insert,arg) pthread_handler_t handle_delayed_insert(void *arg)
{ {
delayed_insert *di=(delayed_insert*) arg; delayed_insert *di=(delayed_insert*) arg;
THD *thd= &di->thd; THD *thd= &di->thd;
......
...@@ -32,7 +32,7 @@ pthread_t manager_thread; ...@@ -32,7 +32,7 @@ pthread_t manager_thread;
pthread_mutex_t LOCK_manager; pthread_mutex_t LOCK_manager;
pthread_cond_t COND_manager; pthread_cond_t COND_manager;
extern "C" pthread_handler_decl(handle_manager,arg __attribute__((unused))) pthread_handler_t handle_manager(void *arg __attribute__((unused)))
{ {
int error = 0; int error = 0;
ulong status; ulong status;
......
...@@ -1046,7 +1046,7 @@ void execute_init_command(THD *thd, sys_var_str *init_command_var, ...@@ -1046,7 +1046,7 @@ void execute_init_command(THD *thd, sys_var_str *init_command_var,
} }
pthread_handler_decl(handle_one_connection,arg) pthread_handler_t handle_one_connection(void *arg)
{ {
THD *thd=(THD*) arg; THD *thd=(THD*) arg;
uint launch_time = uint launch_time =
...@@ -1182,7 +1182,7 @@ pthread_handler_decl(handle_one_connection,arg) ...@@ -1182,7 +1182,7 @@ pthread_handler_decl(handle_one_connection,arg)
Used when creating the initial grant tables Used when creating the initial grant tables
*/ */
extern "C" pthread_handler_decl(handle_bootstrap,arg) pthread_handler_t handle_bootstrap(void *arg)
{ {
THD *thd=(THD*) arg; THD *thd=(THD*) arg;
FILE *file=bootstrap_file; FILE *file=bootstrap_file;
......
...@@ -332,8 +332,8 @@ static int client_msg_raw(NET* net,int err_code,int pre,const char* fmt, ...@@ -332,8 +332,8 @@ static int client_msg_raw(NET* net,int err_code,int pre,const char* fmt,
static int authenticate(struct manager_thd* thd); static int authenticate(struct manager_thd* thd);
/* returns pointer to end of line */ /* returns pointer to end of line */
static char* read_line(struct manager_thd* thd); static char* read_line(struct manager_thd* thd);
static pthread_handler_decl(process_connection, arg); pthread_handler_t process_connection(void *arg);
static pthread_handler_decl(process_launcher_messages, arg); pthread_handler_t process_launcher_messages(void *arg);
static int exec_line(struct manager_thd* thd,char* buf,char* buf_end); static int exec_line(struct manager_thd* thd,char* buf,char* buf_end);
#ifdef DO_STACKTRACE #ifdef DO_STACKTRACE
...@@ -1089,8 +1089,7 @@ static void log_msg(const char* fmt, int msg_type, va_list args) ...@@ -1089,8 +1089,7 @@ static void log_msg(const char* fmt, int msg_type, va_list args)
pthread_mutex_unlock(&lock_log); pthread_mutex_unlock(&lock_log);
} }
static pthread_handler_decl(process_launcher_messages, pthread_handler_t process_launcher_messages(void *arg __attribute__((unused)))
args __attribute__((unused)))
{ {
my_thread_init(); my_thread_init();
for (;!in_shutdown;) for (;!in_shutdown;)
...@@ -1146,7 +1145,7 @@ static pthread_handler_decl(process_launcher_messages, ...@@ -1146,7 +1145,7 @@ static pthread_handler_decl(process_launcher_messages,
return 0; return 0;
} }
static pthread_handler_decl(process_connection,arg) pthread_handler_t process_connection(void *arg)
{ {
struct manager_thd* thd = (struct manager_thd*)arg; struct manager_thd* thd = (struct manager_thd*)arg;
my_thread_init(); my_thread_init();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment