MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NdbThread.h
1 /*
2  Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; version 2 of the License.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #ifndef NDB_THREAD_H
19 #define NDB_THREAD_H
20 
21 #include <ndb_global.h>
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 typedef enum NDB_THREAD_PRIO_ENUM {
28  NDB_THREAD_PRIO_HIGHEST,
29  NDB_THREAD_PRIO_HIGH,
30  NDB_THREAD_PRIO_MEAN,
31  NDB_THREAD_PRIO_LOW,
32  NDB_THREAD_PRIO_LOWEST
33 } NDB_THREAD_PRIO;
34 
35 typedef enum NDB_THREAD_TLS_ENUM {
36  NDB_THREAD_TLS_JAM, /* Jam buffer pointer. */
37  NDB_THREAD_TLS_THREAD, /* Thread self pointer. */
38  NDB_THREAD_TLS_MAX
39 } NDB_THREAD_TLS;
40 
41 typedef void* (NDB_THREAD_FUNC)(void*);
42 typedef void* NDB_THREAD_ARG;
43 typedef size_t NDB_THREAD_STACKSIZE;
44 
45 struct NdbThread;
46 
47 /*
48  Method to block/unblock thread from receiving KILL signal with
49  signum set in g_ndb_shm_signum in a portable manner.
50 */
51 #ifdef NDB_SHM_TRANSPORTER
52 void NdbThread_set_shm_sigmask(my_bool block);
53 #endif
54 
64 struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func,
65  NDB_THREAD_ARG *p_thread_arg,
66  const NDB_THREAD_STACKSIZE thread_stack_size,
67  const char* p_thread_name,
68  NDB_THREAD_PRIO thread_prio);
69 
70 
75 struct NdbThread* NdbThread_CreateObject(const char * name);
76 
83 void NdbThread_Destroy(struct NdbThread** p_thread);
84 
93 int NdbThread_WaitFor(struct NdbThread* p_wait_thread, void** status);
94 
100 void NdbThread_Exit(void *status);
101 
107 int NdbThread_SetConcurrencyLevel(int level);
108 
114 int NdbThread_GetTid(struct NdbThread*);
115 
119 int NdbThread_SetScheduler(struct NdbThread*, my_bool rt_prio, my_bool high_prio);
120 
124 int NdbThread_LockCPU(struct NdbThread*, Uint32 cpu);
125 
129 void *NdbThread_GetTlsKey(NDB_THREAD_TLS key);
130 void NdbThread_SetTlsKey(NDB_THREAD_TLS key, void *value);
131 
144 int NdbThread_SetHighPrioProperties(const char * spec);
145 
146 #ifdef __cplusplus
147 }
148 #endif
149 
150 #endif