MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mt.hpp
1 /* Copyright (C) 2008 MySQL AB, 2008, 2009 Sun Microsystems, Inc.
2  All rights reserved. Use is subject to license terms.
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 Street, Fifth Floor, Boston, MA 02110-1301, USA */
16 
17 #include <kernel_types.h>
18 #include <TransporterDefinitions.hpp>
19 
20 #ifndef ndb_mt_hpp
21 #define ndb_mt_hpp
22 
23 
24 /*
25  For now, we use locks to only have one thread at the time running in the
26  transporter as sender, and only one as receiver.
27 
28  Thus, we can use a global variable to record the id of the current
29  transporter threads. Only valid while holding the transporter receive lock.
30 */
31 extern Uint32 receiverThreadId;
32 
33 /* Assign block instances to thread */
34 void add_thr_map(Uint32 block, Uint32 instance, Uint32 thr_no);
35 void add_main_thr_map();
36 void add_lqh_worker_thr_map(Uint32 block, Uint32 instance);
37 void add_extra_worker_thr_map(Uint32 block, Uint32 instance);
38 void finalize_thr_map();
39 
40 void sendlocal(Uint32 self, const struct SignalHeader *s,
41  const Uint32 *data, const Uint32 secPtr[3]);
42 void sendprioa(Uint32 self, const struct SignalHeader *s,
43  const Uint32 *data, const Uint32 secPtr[3]);
44 void senddelay(Uint32 thr_no, const struct SignalHeader*, Uint32 delay);
45 void mt_execSTOP_FOR_CRASH();
46 
47 SendStatus mt_send_remote(Uint32 self, const SignalHeader *sh, Uint8 prio,
48  const Uint32 *data, NodeId nodeId,
49  const LinearSectionPtr ptr[3]);
50 SendStatus mt_send_remote(Uint32 self, const SignalHeader *sh, Uint8 prio,
51  const Uint32 *data, NodeId nodeId,
52  class SectionSegmentPool *thePool,
53  const SegmentedSectionPtr ptr[3]);
54 
58 void mt_section_lock();
59 void mt_section_unlock();
60 
64 bool NdbIsMultiThreaded();
65 
74 Uint32 mt_get_thread_references_for_blocks(const Uint32 blocks[],
75  Uint32 ownThreadId,
76  Uint32 dst[], Uint32 len);
77 
81 void mt_wakeup(class SimulatedBlock*);
82 
83 #ifdef VM_TRACE
84 
87 void mt_assert_own_thread(class SimulatedBlock*);
88 #endif
89 
90 #endif