InnoDB Plugin  1.0
Macros | Typedefs | Functions
os0thread.h File Reference
#include "univ.i"
#include "os0thread.ic"
Include dependency graph for os0thread.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


#define OS_THREAD_MAX_N   srv_max_n_threads
#define DECLARE_THREAD(func)   func
#define os_thread_create(f, a, i)   os_thread_create_func(f, a, i)


typedef pthread_t os_thread_t
typedef os_thread_t os_thread_id_t
typedef void *(* os_thread_func_t )(void *)
typedef void *(* os_posix_f_t )(void *)


UNIV_INTERN ibool os_thread_eq (os_thread_id_t a, os_thread_id_t b)
UNIV_INTERN ulint os_thread_pf (os_thread_id_t a)
UNIV_INTERN os_thread_t os_thread_create_func (os_thread_func_t func, void *arg, os_thread_id_t *thread_id)
UNIV_INTERN void os_thread_exit (void *exit_value) UNIV_COLD)
UNIV_INTERN os_thread_id_t os_thread_get_curr_id (void)
UNIV_INTERN void os_thread_yield (void)
UNIV_INTERN void os_thread_sleep (ulint tm)

Detailed Description

The interface to the operating system process and thread control primitives

Created 9/8/1995 Heikki Tuuri

Macro Definition Documentation

#define DECLARE_THREAD (   func)    func

Macro for specifying a POSIX thread start function.

Typedef Documentation

typedef os_thread_t os_thread_id_t

In Unix we use the thread handle itself as the id of the thread

Function Documentation

UNIV_INTERN os_thread_t os_thread_create_func ( os_thread_func_t  func,
void *  arg,
os_thread_id_t thread_id 

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.

handle to the thread out: id of the created thread, or NULL
funcin: pointer to function from which to start
argin: argument to start function
UNIV_INTERN ibool os_thread_eq ( os_thread_id_t  a,
os_thread_id_t  b 

Compares two thread ids for equality.

TRUE if equal in: OS thread or thread id
ain: OS thread or thread id
UNIV_INTERN void os_thread_exit ( void *  exit_value)

Exits the current thread.

exit_valuein: exit value; in Windows this void* is cast as a DWORD
UNIV_INTERN os_thread_id_t os_thread_get_curr_id ( void  )

Returns the thread identifier of current thread.

current thread identifier
UNIV_INTERN ulint os_thread_pf ( os_thread_id_t  a)

Converts an OS thread id to a ulint. It is NOT guaranteed that the ulint is unique for the thread though!

thread identifier as a number in: OS thread identifier
UNIV_INTERN void os_thread_sleep ( ulint  tm)

The thread sleeps at least the time given in microseconds. in: time in microseconds

UNIV_INTERN void os_thread_yield ( void  )

Advises the os to give up remainder of the thread's time slice.