summaryrefslogtreecommitdiff
path: root/storage/xtradb/os/os0thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'storage/xtradb/os/os0thread.c')
-rw-r--r--storage/xtradb/os/os0thread.c81
1 files changed, 45 insertions, 36 deletions
diff --git a/storage/xtradb/os/os0thread.c b/storage/xtradb/os/os0thread.c
index 7d0a57ae17c..9a2d95cb166 100644
--- a/storage/xtradb/os/os0thread.c
+++ b/storage/xtradb/os/os0thread.c
@@ -16,7 +16,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
-/******************************************************
+/**************************************************//**
+@file os/os0thread.c
The interface to the operating system thread control primitives
Created 9/8/1995 Heikki Tuuri
@@ -31,18 +32,19 @@ Created 9/8/1995 Heikki Tuuri
#include <windows.h>
#endif
+#ifndef UNIV_HOTBACKUP
#include "srv0srv.h"
#include "os0sync.h"
-/*******************************************************************
-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 */
{
#ifdef __WIN__
if (a == b) {
@@ -59,14 +61,15 @@ os_thread_eq(
#endif
}
-/********************************************************************
+/****************************************************************//**
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(
/*=========*/
- os_thread_id_t a)
+ os_thread_id_t a) /*!< in: OS thread identifier */
{
#ifdef UNIV_HPUX10
/* In HP-UX-10.20 a pthread_t is a struct of 3 fields: field1, field2,
@@ -78,10 +81,11 @@ os_thread_pf(
#endif
}
-/*********************************************************************
+/*****************************************************************//**
Returns the thread identifier of current thread. Currently the thread
identifier in Unix is the thread handle itself. Note that in HP-UX
-pthread_t is a struct of 3 fields. */
+pthread_t is a struct of 3 fields.
+@return current thread identifier */
UNIV_INTERN
os_thread_id_t
os_thread_get_curr_id(void)
@@ -94,24 +98,24 @@ os_thread_get_curr_id(void)
#endif
}
-/********************************************************************
+/****************************************************************//**
Creates a new thread of execution. The execution starts from
the function given. The start function takes a void* parameter
-and returns an ulint. */
+and returns an ulint.
+@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 */
{
#ifdef __WIN__
@@ -148,7 +152,7 @@ os_thread_create(
os_thread_t pthread;
pthread_attr_t attr;
-#if !(defined(UNIV_HOTBACKUP) && defined(UNIV_HPUX10))
+#ifndef UNIV_HPUX10
pthread_attr_init(&attr);
#endif
@@ -182,7 +186,7 @@ os_thread_create(
os_thread_count++;
os_mutex_exit(os_sync_mutex);
-#if defined(UNIV_HOTBACKUP) && defined(UNIV_HPUX10)
+#ifdef UNIV_HPUX10
ret = pthread_create(&pthread, pthread_attr_default, start_f, arg);
#else
ret = pthread_create(&pthread, &attr, start_f, arg);
@@ -193,7 +197,7 @@ os_thread_create(
exit(1);
}
-#if !(defined(UNIV_HOTBACKUP) && defined(UNIV_HPUX10))
+#ifndef UNIV_HPUX10
pthread_attr_destroy(&attr);
#endif
if (srv_set_thread_priorities) {
@@ -209,13 +213,13 @@ os_thread_create(
#endif
}
-/*********************************************************************
+/*****************************************************************//**
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 */
{
#ifdef UNIV_DEBUG_THREAD_CREATION
@@ -233,8 +237,9 @@ os_thread_exit(
#endif
}
-/*********************************************************************
-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)
@@ -247,7 +252,7 @@ os_thread_get_curr(void)
#endif
}
-/*********************************************************************
+/*****************************************************************//**
Advises the os to give up remainder of the thread's time slice. */
UNIV_INTERN
void
@@ -266,14 +271,15 @@ os_thread_yield(void)
os_thread_sleep(0);
#endif
}
+#endif /* !UNIV_HOTBACKUP */
-/*********************************************************************
+/*****************************************************************//**
The thread sleeps at least the time given in microseconds. */
UNIV_INTERN
void
os_thread_sleep(
/*============*/
- ulint tm) /* in: time in microseconds */
+ ulint tm) /*!< in: time in microseconds */
{
#ifdef __WIN__
Sleep((DWORD) tm / 1000);
@@ -289,14 +295,15 @@ os_thread_sleep(
#endif
}
-/**********************************************************************
+#ifndef UNIV_HOTBACKUP
+/******************************************************************//**
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 */
+ os_thread_t handle, /*!< in: OS handle to the thread */
+ ulint pri) /*!< in: priority */
{
#ifdef __WIN__
int os_pri;
@@ -318,15 +325,15 @@ os_thread_set_priority(
#endif
}
-/**********************************************************************
-Gets a thread priority. */
+/******************************************************************//**
+Gets a thread priority.
+@return priority */
UNIV_INTERN
ulint
os_thread_get_priority(
/*===================*/
- /* out: priority */
os_thread_t handle __attribute__((unused)))
- /* in: OS handle to the thread */
+ /*!< in: OS handle to the thread */
{
#ifdef __WIN__
int os_pri;
@@ -350,8 +357,9 @@ os_thread_get_priority(
#endif
}
-/**********************************************************************
-Gets the last operating system error code for the calling thread. */
+/******************************************************************//**
+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)
@@ -363,3 +371,4 @@ os_thread_get_last_error(void)
return(0);
#endif
}
+#endif /* !UNIV_HOTBACKUP */