diff --git a/include/srv0srv.h b/include/srv0srv.h index 2f2bc316873..ff82cb2999a 100644 --- a/include/srv0srv.h +++ b/include/srv0srv.h @@ -344,11 +344,7 @@ srv_release_threads( /************************************************************************* The master thread controlling the server. */ -#ifndef __WIN__ -void* -#else -ulint -#endif +os_thread_ret_t srv_master_thread( /*==============*/ /* out: a dummy parameter */ @@ -430,11 +426,7 @@ srv_release_mysql_thread_if_suspended( A thread which wakes up threads whose lock wait may have lasted too long. This also prints the info output by various InnoDB monitors. */ -#ifndef __WIN__ -void* -#else -ulint -#endif +os_thread_ret_t srv_lock_timeout_and_monitor_thread( /*================================*/ /* out: a dummy parameter */ @@ -444,11 +436,7 @@ srv_lock_timeout_and_monitor_thread( A thread which prints warnings about semaphore waits which have lasted too long. These can be used to track bugs which cause hangs. */ -#ifndef __WIN__ -void* -#else -ulint -#endif +os_thread_ret_t srv_error_monitor_thread( /*=====================*/ /* out: a dummy parameter */ diff --git a/include/trx0roll.h b/include/trx0roll.h index 7b450f9da39..25546430ba0 100644 --- a/include/trx0roll.h +++ b/include/trx0roll.h @@ -107,11 +107,7 @@ transaction already was committed, then we clean up a possible insert undo log. If the transaction was not yet committed, then we roll it back. Note: this is done in a background thread. */ -#ifndef __WIN__ -void* -#else -ulint -#endif +os_thread_ret_t trx_rollback_or_clean_all_without_sess( /*===================================*/ /* out: a dummy parameter */ diff --git a/include/univ.i b/include/univ.i index 5b294ae0769..c5e87e468c6 100644 --- a/include/univ.i +++ b/include/univ.i @@ -273,6 +273,18 @@ it is read or written. */ /* Compile-time constant of the given array's size. */ #define UT_ARR_SIZE(a) (sizeof(a) / sizeof((a)[0])) +/* The return type from a thread's start function differs between Unix and +Windows, so define a typedef for it and a macro to use at the end of such +functions. */ + +#ifdef __WIN__ +typedef ulint os_thread_ret_t; +#define OS_THREAD_DUMMY_RETURN return(0) +#else +typedef void* os_thread_ret_t; +#define OS_THREAD_DUMMY_RETURN return(NULL) +#endif + #include #include "ut0dbg.h" #include "ut0ut.h" diff --git a/srv/srv0srv.c b/srv/srv0srv.c index cacaebaea2b..83cdcaa271b 100644 --- a/srv/srv0srv.c +++ b/srv/srv0srv.c @@ -1819,11 +1819,7 @@ srv_export_innodb_status(void) A thread which wakes up threads whose lock wait may have lasted too long. This also prints the info output by various InnoDB monitors. */ -#ifndef __WIN__ -void* -#else -ulint -#endif +os_thread_ret_t srv_lock_timeout_and_monitor_thread( /*================================*/ /* out: a dummy parameter */ @@ -1995,22 +1991,15 @@ exit_func: thread should always use that to exit and not use return() to exit. */ os_thread_exit(NULL); -#ifndef __WIN__ - return(NULL); -#else - return(0); -#endif + + OS_THREAD_DUMMY_RETURN; } /************************************************************************* A thread which prints warnings about semaphore waits which have lasted too long. These can be used to track bugs which cause hangs. */ -#ifndef __WIN__ -void* -#else -ulint -#endif +os_thread_ret_t srv_error_monitor_thread( /*=====================*/ /* out: a dummy parameter */ @@ -2092,11 +2081,7 @@ loop: os_thread_exit(NULL); -#ifndef __WIN__ - return(NULL); -#else - return(0); -#endif + OS_THREAD_DUMMY_RETURN; } /*********************************************************************** @@ -2141,11 +2126,7 @@ srv_wake_master_thread(void) /************************************************************************* The master thread controlling the server. */ -#ifndef __WIN__ -void* -#else -ulint -#endif +os_thread_ret_t srv_master_thread( /*==============*/ /* out: a dummy parameter */ @@ -2590,10 +2571,6 @@ suspend_thread: os_thread_exit(NULL); -#ifndef __WIN__ - return(NULL); /* Not reached */ -#else - return(0); -#endif + OS_THREAD_DUMMY_RETURN; } #endif /* !UNIV_HOTBACKUP */ diff --git a/srv/srv0start.c b/srv/srv0start.c index 6b55092a068..da2deac123d 100644 --- a/srv/srv0start.c +++ b/srv/srv0start.c @@ -426,11 +426,7 @@ srv_parse_log_group_home_dirs( I/o-handler thread function. */ static -#ifndef __WIN__ -void* -#else -ulint -#endif +os_thread_ret_t io_handler_thread( /*==============*/ void* arg) @@ -459,11 +455,7 @@ io_handler_thread( os_thread_exit(NULL); -#ifndef __WIN__ - return(NULL); /* Not reached */ -#else - return(0); -#endif + OS_THREAD_DUMMY_RETURN; } #endif /* !UNIV_HOTBACKUP */ diff --git a/trx/trx0roll.c b/trx/trx0roll.c index fd733ef5fb8..af74cfe9032 100644 --- a/trx/trx0roll.c +++ b/trx/trx0roll.c @@ -391,11 +391,7 @@ transaction already was committed, then we clean up a possible insert undo log. If the transaction was not yet committed, then we roll it back. Note: this is done in a background thread. */ -#ifndef __WIN__ -void* -#else -ulint -#endif +os_thread_ret_t trx_rollback_or_clean_all_without_sess( /*===================================*/ /* out: a dummy parameter */ @@ -576,13 +572,7 @@ leave_function: os_thread_exit(NULL); - /* The following is dummy code to keep the compiler happy: */ - -#ifndef __WIN__ - return(NULL); -#else - return(0); -#endif + OS_THREAD_DUMMY_RETURN; } /***********************************************************************