diff options
Diffstat (limited to 'storage/xtradb/include/os0thread.h')
-rw-r--r-- | storage/xtradb/include/os0thread.h | 76 |
1 files changed, 40 insertions, 36 deletions
diff --git a/storage/xtradb/include/os0thread.h b/storage/xtradb/include/os0thread.h index 863596bfa84..6583de0005f 100644 --- a/storage/xtradb/include/os0thread.h +++ b/storage/xtradb/include/os0thread.h @@ -16,7 +16,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA *****************************************************************************/ -/****************************************************** +/**************************************************//** +@file include/os0thread.h The interface to the operating system process and thread control primitives @@ -43,11 +44,11 @@ can wait inside InnoDB */ #ifdef __WIN__ typedef void* os_thread_t; -typedef ulint os_thread_id_t; /* In Windows the thread id +typedef unsigned long os_thread_id_t; /*!< In Windows the thread id is an unsigned long int */ #else typedef pthread_t os_thread_t; -typedef os_thread_t os_thread_id_t; /* In Unix we use the thread +typedef os_thread_t os_thread_id_t; /*!< In Unix we use the thread handle itself as the id of the thread */ #endif @@ -55,97 +56,100 @@ typedef os_thread_t os_thread_id_t; /* In Unix we use the thread /* Define a function pointer type to use in a typecast */ typedef void* (*os_posix_f_t) (void*); -/******************************************************************* -Compares two thread ids for equality. */ +/***************************************************************//** +Compares two thread ids for equality. +@return TRUE if equal */ UNIV_INTERN ibool os_thread_eq( /*=========*/ - /* out: TRUE if equal */ - os_thread_id_t a, /* in: OS thread or thread id */ - os_thread_id_t b); /* in: OS thread or thread id */ -/******************************************************************** + os_thread_id_t a, /*!< in: OS thread or thread id */ + os_thread_id_t b); /*!< in: OS thread or thread id */ +/****************************************************************//** Converts an OS thread id to a ulint. It is NOT guaranteed that the ulint is -unique for the thread though! */ +unique for the thread though! +@return thread identifier as a number */ UNIV_INTERN ulint os_thread_pf( /*=========*/ - /* out: unsigned long int */ - os_thread_id_t a); /* in: thread or thread id */ -/******************************************************************** + os_thread_id_t a); /*!< in: OS thread identifier */ +/****************************************************************//** Creates a new thread of execution. The execution starts from the function given. The start function takes a void* parameter and returns a ulint. NOTE: We count the number of threads in os_thread_exit(). A created -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. +@return handle to the thread */ UNIV_INTERN os_thread_t os_thread_create( /*=============*/ - /* out: handle to the thread */ #ifndef __WIN__ os_posix_f_t start_f, #else - ulint (*start_f)(void*), /* in: pointer to function + ulint (*start_f)(void*), /*!< in: pointer to function from which to start */ #endif - void* arg, /* in: argument to start + void* arg, /*!< in: argument to start function */ - os_thread_id_t* thread_id); /* out: id of the created + os_thread_id_t* thread_id); /*!< out: id of the created thread, or NULL */ -/********************************************************************* +/*****************************************************************//** Exits the current thread. */ UNIV_INTERN void os_thread_exit( /*===========*/ - void* exit_value); /* in: exit value; in Windows this void* + void* exit_value); /*!< in: exit value; in Windows this void* is cast as a DWORD */ -/********************************************************************* -Returns the thread identifier of current thread. */ +/*****************************************************************//** +Returns the thread identifier of current thread. +@return current thread identifier */ UNIV_INTERN os_thread_id_t os_thread_get_curr_id(void); /*========================*/ -/********************************************************************* -Returns handle to the current thread. */ +/*****************************************************************//** +Returns handle to the current thread. +@return current thread handle */ UNIV_INTERN os_thread_t os_thread_get_curr(void); /*====================*/ -/********************************************************************* +/*****************************************************************//** Advises the os to give up remainder of the thread's time slice. */ UNIV_INTERN void os_thread_yield(void); /*=================*/ -/********************************************************************* +/*****************************************************************//** The thread sleeps at least the time given in microseconds. */ UNIV_INTERN void os_thread_sleep( /*============*/ - ulint tm); /* in: time in microseconds */ -/********************************************************************** -Gets a thread priority. */ + ulint tm); /*!< in: time in microseconds */ +/******************************************************************//** +Gets a thread priority. +@return priority */ UNIV_INTERN ulint os_thread_get_priority( /*===================*/ - /* out: priority */ - os_thread_t handle);/* in: OS handle to the thread */ -/********************************************************************** + os_thread_t handle);/*!< in: OS handle to the thread */ +/******************************************************************//** Sets a thread priority. */ UNIV_INTERN void os_thread_set_priority( /*===================*/ - os_thread_t handle, /* in: OS handle to the thread */ - ulint pri); /* in: priority: one of OS_PRIORITY_... */ -/********************************************************************** -Gets the last operating system error code for the calling thread. */ + os_thread_t handle, /*!< in: OS handle to the thread */ + ulint pri); /*!< in: priority: one of OS_PRIORITY_... */ +/******************************************************************//** +Gets the last operating system error code for the calling thread. +@return last error on Windows, 0 otherwise */ UNIV_INTERN ulint os_thread_get_last_error(void); |