Commit ca150507 authored by osku's avatar osku

Add platform-specific os_thread_ret_t and OS_THREAD_DUMMY_RETURN, and

convert thread start functions to use them.
parent 160cd2b2
...@@ -344,11 +344,7 @@ srv_release_threads( ...@@ -344,11 +344,7 @@ srv_release_threads(
/************************************************************************* /*************************************************************************
The master thread controlling the server. */ The master thread controlling the server. */
#ifndef __WIN__ os_thread_ret_t
void*
#else
ulint
#endif
srv_master_thread( srv_master_thread(
/*==============*/ /*==============*/
/* out: a dummy parameter */ /* out: a dummy parameter */
...@@ -430,11 +426,7 @@ srv_release_mysql_thread_if_suspended( ...@@ -430,11 +426,7 @@ srv_release_mysql_thread_if_suspended(
A thread which wakes up threads whose lock wait may have lasted too long. A thread which wakes up threads whose lock wait may have lasted too long.
This also prints the info output by various InnoDB monitors. */ This also prints the info output by various InnoDB monitors. */
#ifndef __WIN__ os_thread_ret_t
void*
#else
ulint
#endif
srv_lock_timeout_and_monitor_thread( srv_lock_timeout_and_monitor_thread(
/*================================*/ /*================================*/
/* out: a dummy parameter */ /* out: a dummy parameter */
...@@ -444,11 +436,7 @@ srv_lock_timeout_and_monitor_thread( ...@@ -444,11 +436,7 @@ srv_lock_timeout_and_monitor_thread(
A thread which prints warnings about semaphore waits which have lasted A thread which prints warnings about semaphore waits which have lasted
too long. These can be used to track bugs which cause hangs. */ too long. These can be used to track bugs which cause hangs. */
#ifndef __WIN__ os_thread_ret_t
void*
#else
ulint
#endif
srv_error_monitor_thread( srv_error_monitor_thread(
/*=====================*/ /*=====================*/
/* out: a dummy parameter */ /* out: a dummy parameter */
......
...@@ -107,11 +107,7 @@ transaction already was committed, then we clean up a possible insert ...@@ -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. undo log. If the transaction was not yet committed, then we roll it back.
Note: this is done in a background thread. */ Note: this is done in a background thread. */
#ifndef __WIN__ os_thread_ret_t
void*
#else
ulint
#endif
trx_rollback_or_clean_all_without_sess( trx_rollback_or_clean_all_without_sess(
/*===================================*/ /*===================================*/
/* out: a dummy parameter */ /* out: a dummy parameter */
......
...@@ -273,6 +273,18 @@ it is read or written. */ ...@@ -273,6 +273,18 @@ it is read or written. */
/* Compile-time constant of the given array's size. */ /* Compile-time constant of the given array's size. */
#define UT_ARR_SIZE(a) (sizeof(a) / sizeof((a)[0])) #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 <stdio.h> #include <stdio.h>
#include "ut0dbg.h" #include "ut0dbg.h"
#include "ut0ut.h" #include "ut0ut.h"
......
...@@ -1819,11 +1819,7 @@ srv_export_innodb_status(void) ...@@ -1819,11 +1819,7 @@ srv_export_innodb_status(void)
A thread which wakes up threads whose lock wait may have lasted too long. A thread which wakes up threads whose lock wait may have lasted too long.
This also prints the info output by various InnoDB monitors. */ This also prints the info output by various InnoDB monitors. */
#ifndef __WIN__ os_thread_ret_t
void*
#else
ulint
#endif
srv_lock_timeout_and_monitor_thread( srv_lock_timeout_and_monitor_thread(
/*================================*/ /*================================*/
/* out: a dummy parameter */ /* out: a dummy parameter */
...@@ -1995,22 +1991,15 @@ exit_func: ...@@ -1995,22 +1991,15 @@ exit_func:
thread should always use that to exit and not use return() to exit. */ thread should always use that to exit and not use return() to exit. */
os_thread_exit(NULL); os_thread_exit(NULL);
#ifndef __WIN__
return(NULL); OS_THREAD_DUMMY_RETURN;
#else
return(0);
#endif
} }
/************************************************************************* /*************************************************************************
A thread which prints warnings about semaphore waits which have lasted A thread which prints warnings about semaphore waits which have lasted
too long. These can be used to track bugs which cause hangs. */ too long. These can be used to track bugs which cause hangs. */
#ifndef __WIN__ os_thread_ret_t
void*
#else
ulint
#endif
srv_error_monitor_thread( srv_error_monitor_thread(
/*=====================*/ /*=====================*/
/* out: a dummy parameter */ /* out: a dummy parameter */
...@@ -2092,11 +2081,7 @@ loop: ...@@ -2092,11 +2081,7 @@ loop:
os_thread_exit(NULL); os_thread_exit(NULL);
#ifndef __WIN__ OS_THREAD_DUMMY_RETURN;
return(NULL);
#else
return(0);
#endif
} }
/*********************************************************************** /***********************************************************************
...@@ -2141,11 +2126,7 @@ srv_wake_master_thread(void) ...@@ -2141,11 +2126,7 @@ srv_wake_master_thread(void)
/************************************************************************* /*************************************************************************
The master thread controlling the server. */ The master thread controlling the server. */
#ifndef __WIN__ os_thread_ret_t
void*
#else
ulint
#endif
srv_master_thread( srv_master_thread(
/*==============*/ /*==============*/
/* out: a dummy parameter */ /* out: a dummy parameter */
...@@ -2590,10 +2571,6 @@ suspend_thread: ...@@ -2590,10 +2571,6 @@ suspend_thread:
os_thread_exit(NULL); os_thread_exit(NULL);
#ifndef __WIN__ OS_THREAD_DUMMY_RETURN;
return(NULL); /* Not reached */
#else
return(0);
#endif
} }
#endif /* !UNIV_HOTBACKUP */ #endif /* !UNIV_HOTBACKUP */
...@@ -426,11 +426,7 @@ srv_parse_log_group_home_dirs( ...@@ -426,11 +426,7 @@ srv_parse_log_group_home_dirs(
I/o-handler thread function. */ I/o-handler thread function. */
static static
#ifndef __WIN__ os_thread_ret_t
void*
#else
ulint
#endif
io_handler_thread( io_handler_thread(
/*==============*/ /*==============*/
void* arg) void* arg)
...@@ -459,11 +455,7 @@ io_handler_thread( ...@@ -459,11 +455,7 @@ io_handler_thread(
os_thread_exit(NULL); os_thread_exit(NULL);
#ifndef __WIN__ OS_THREAD_DUMMY_RETURN;
return(NULL); /* Not reached */
#else
return(0);
#endif
} }
#endif /* !UNIV_HOTBACKUP */ #endif /* !UNIV_HOTBACKUP */
......
...@@ -391,11 +391,7 @@ transaction already was committed, then we clean up a possible insert ...@@ -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. undo log. If the transaction was not yet committed, then we roll it back.
Note: this is done in a background thread. */ Note: this is done in a background thread. */
#ifndef __WIN__ os_thread_ret_t
void*
#else
ulint
#endif
trx_rollback_or_clean_all_without_sess( trx_rollback_or_clean_all_without_sess(
/*===================================*/ /*===================================*/
/* out: a dummy parameter */ /* out: a dummy parameter */
...@@ -576,13 +572,7 @@ leave_function: ...@@ -576,13 +572,7 @@ leave_function:
os_thread_exit(NULL); os_thread_exit(NULL);
/* The following is dummy code to keep the compiler happy: */ OS_THREAD_DUMMY_RETURN;
#ifndef __WIN__
return(NULL);
#else
return(0);
#endif
} }
/*********************************************************************** /***********************************************************************
......
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