diff options
Diffstat (limited to 'storage/innobase/include/os0thread.h')
-rw-r--r-- | storage/innobase/include/os0thread.h | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/storage/innobase/include/os0thread.h b/storage/innobase/include/os0thread.h index df3cdb7728e..37c54afae80 100644 --- a/storage/innobase/include/os0thread.h +++ b/storage/innobase/include/os0thread.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA +this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA *****************************************************************************/ @@ -35,7 +35,6 @@ can wait inside InnoDB */ #define OS_THREAD_MAX_N srv_max_n_threads - /* Possible fixed priorities for threads */ #define OS_THREAD_PRIORITY_NONE 100 #define OS_THREAD_PRIORITY_BACKGROUND 1 @@ -44,14 +43,35 @@ can wait inside InnoDB */ #ifdef __WIN__ typedef void* os_thread_t; -typedef unsigned long os_thread_id_t; /*!< In Windows the thread id +typedef DWORD os_thread_id_t; /*!< In Windows the thread id is an unsigned long int */ +extern "C" { +typedef LPTHREAD_START_ROUTINE os_thread_func_t; +} + +/** Macro for specifying a Windows thread start function. */ +#define DECLARE_THREAD(func) WINAPI func + +/** Required to get around a build error on Windows. Even though our functions +are defined/declared as WINAPI f(LPVOID a); the compiler complains that they +are defined as: os_thread_ret_t (__cdecl*)(void*). Because our functions +don't access the arguments and don't return any value, we should be safe. */ +#define os_thread_create(f,a,i) \ + os_thread_create_func(reinterpret_cast<os_thread_func_t>(f), a, i) + #else + typedef pthread_t os_thread_t; typedef os_thread_t os_thread_id_t; /*!< In Unix we use the thread handle itself as the id of the thread */ -#endif +extern "C" { typedef void* (*os_thread_func_t)(void*); } + +/** Macro for specifying a POSIX thread start function. */ +#define DECLARE_THREAD(func) func +#define os_thread_create(f,a,i) os_thread_create_func(f, a, i) + +#endif /* __WIN__ */ /* Define a function pointer type to use in a typecast */ typedef void* (*os_posix_f_t) (void*); @@ -88,14 +108,10 @@ thread should always use that to exit and not use return() to exit. @return handle to the thread */ UNIV_INTERN os_thread_t -os_thread_create( -/*=============*/ -#ifndef __WIN__ - os_posix_f_t start_f, -#else - ulint (*start_f)(void*), /*!< in: pointer to function +os_thread_create_func( +/*==================*/ + os_thread_func_t func, /*!< in: pointer to function from which to start */ -#endif void* arg, /*!< in: argument to start function */ os_thread_id_t* thread_id); /*!< out: id of the created |