drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
os0thread.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (C) 1995, 2009, Innobase Oy. All Rights Reserved.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License as published by the Free Software
7Foundation; version 2 of the License.
8
9This program is distributed in the hope that it will be useful, but WITHOUT
10ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13You should have received a copy of the GNU General Public License along with
14this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15St, Fifth Floor, Boston, MA 02110-1301 USA
16
17*****************************************************************************/
18
19/**************************************************/
26
27#pragma once
28#ifndef os0thread_h
29#define os0thread_h
30
31#include "univ.i"
32
33/* Maximum number of threads which can be created in the program;
34this is also the size of the wait slot array for MySQL threads which
35can wait inside InnoDB */
36
37#define OS_THREAD_MAX_N srv_max_n_threads
38
39
40/* Possible fixed priorities for threads */
41#define OS_THREAD_PRIORITY_NONE 100
42#define OS_THREAD_PRIORITY_BACKGROUND 1
43#define OS_THREAD_PRIORITY_NORMAL 2
44#define OS_THREAD_PRIORITY_ABOVE_NORMAL 3
45
46#ifdef __WIN__
47typedef void* os_thread_t;
48typedef unsigned long os_thread_id_t;
50#else
51#include <pthread.h>
52typedef pthread_t os_thread_t;
53typedef os_thread_t os_thread_id_t;
56#endif
57
58/* Define a function pointer type to use in a typecast */
59typedef void* (*os_posix_f_t) (void*);
60
61#ifdef HAVE_PSI_INTERFACE
62/* Define for performance schema registration key */
63typedef unsigned int mysql_pfs_key_t;
64#endif
65
66/***************************************************************/
69UNIV_INTERN
70ibool
72/*=========*/
75/****************************************************************/
79UNIV_INTERN
80ulint
82/*=========*/
84/****************************************************************/
91UNIV_INTERN
92os_thread_t
94/*=============*/
95#ifndef __WIN__
96 os_posix_f_t start_f,
97#else
98 ulint (*start_f)(void*),
100#endif
101 void* arg,
103 os_thread_id_t* thread_id);
105/*****************************************************************/
107UNIV_INTERN
108void
110/*===========*/
111 void* exit_value);
113/*****************************************************************/
116UNIV_INTERN
119/*========================*/
120/*****************************************************************/
123UNIV_INTERN
124os_thread_t
126/*====================*/
127/*****************************************************************/
129UNIV_INTERN
130void
131os_thread_yield(void);
132/*=================*/
133/*****************************************************************/
135UNIV_INTERN
136void
138/*============*/
139 ulint tm);
140/******************************************************************/
143UNIV_INTERN
144ulint
146/*===================*/
147 os_thread_t handle);
148/******************************************************************/
150UNIV_INTERN
151void
153/*===================*/
154 os_thread_t handle,
155 ulint pri);
156/******************************************************************/
159UNIV_INTERN
160ulint
162/*==========================*/
163
164#ifndef UNIV_NONINL
165#include "os0thread.ic"
166#endif
167
168#endif
UNIV_INTERN void os_thread_yield(void)
Definition os0thread.cc:244
os_thread_t os_thread_id_t
Definition os0thread.h:53
UNIV_INTERN os_thread_t os_thread_create(os_posix_f_t start_f, void *arg, os_thread_id_t *thread_id)
Definition os0thread.cc:110
UNIV_INTERN ulint os_thread_get_last_error(void)
Definition os0thread.cc:348
UNIV_INTERN void os_thread_set_priority(os_thread_t handle, ulint pri)
Definition os0thread.cc:286
UNIV_INTERN void os_thread_exit(void *exit_value)
Definition os0thread.cc:199
UNIV_INTERN ibool os_thread_eq(os_thread_id_t a, os_thread_id_t b)
Definition os0thread.cc:46
UNIV_INTERN void os_thread_sleep(ulint tm)
Definition os0thread.cc:265
UNIV_INTERN os_thread_t os_thread_get_curr(void)
Definition os0thread.cc:230
UNIV_INTERN ulint os_thread_get_priority(os_thread_t handle)
Definition os0thread.cc:316
UNIV_INTERN os_thread_id_t os_thread_get_curr_id(void)
Definition os0thread.cc:93
UNIV_INTERN ulint os_thread_pf(os_thread_id_t a)
Definition os0thread.cc:72