Drizzled Public API Documentation

os0thread.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (C) 1995, 2009, Innobase Oy. All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free Software
7 Foundation; version 2 of the License.
8 
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License along with
14 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15 St, Fifth Floor, Boston, MA 02110-1301 USA
16 
17 *****************************************************************************/
18 
19 /**************************************************/
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;
34 this is also the size of the wait slot array for MySQL threads which
35 can 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__
47 typedef void* os_thread_t;
48 typedef unsigned long os_thread_id_t;
50 #else
51 #include <pthread.h>
52 typedef pthread_t os_thread_t;
53 typedef os_thread_t os_thread_id_t;
56 #endif
57 
58 /* Define a function pointer type to use in a typecast */
59 typedef void* (*os_posix_f_t) (void*);
60 
61 #ifdef HAVE_PSI_INTERFACE
62 /* Define for performance schema registration key */
63 typedef unsigned int mysql_pfs_key_t;
64 #endif
65 
66 /***************************************************************/
69 UNIV_INTERN
70 ibool
72 /*=========*/
73  os_thread_id_t a,
74  os_thread_id_t b);
75 /****************************************************************/
79 UNIV_INTERN
80 ulint
82 /*=========*/
83  os_thread_id_t a);
84 /****************************************************************/
91 UNIV_INTERN
92 os_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 /*****************************************************************/
107 UNIV_INTERN
108 void
110 /*===========*/
111  void* exit_value);
113 /*****************************************************************/
116 UNIV_INTERN
119 /*========================*/
120 /*****************************************************************/
123 UNIV_INTERN
124 os_thread_t
125 os_thread_get_curr(void);
126 /*====================*/
127 /*****************************************************************/
129 UNIV_INTERN
130 void
131 os_thread_yield(void);
132 /*=================*/
133 /*****************************************************************/
135 UNIV_INTERN
136 void
138 /*============*/
139  ulint tm);
140 /******************************************************************/
143 UNIV_INTERN
144 ulint
146 /*===================*/
147  os_thread_t handle);
148 /******************************************************************/
150 UNIV_INTERN
151 void
153 /*===================*/
154  os_thread_t handle,
155  ulint pri);
156 /******************************************************************/
159 UNIV_INTERN
160 ulint
162 /*==========================*/
163 
164 #ifndef UNIV_NONINL
165 #include "os0thread.ic"
166 #endif
167 
168 #endif