mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / storage / ndb / src / kernel / vm / GlobalData.hpp
blobfa9f23da4e1554e3b625fd481e49a2dd445e3fbd
1 /* Copyright (c) 2003-2007 MySQL AB
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 of the License.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
16 #ifndef GLOBAL_DATA_H
17 #define GLOBAL_DATA_H
19 #include <ndb_global.h>
20 #include <kernel_types.h>
21 #include "Prio.hpp"
22 #include "VMSignal.hpp"
24 #include <BlockNumbers.h>
25 #include <NodeState.hpp>
26 #include <NodeInfo.hpp>
27 #include "ArrayPool.hpp"
29 class SimulatedBlock;
31 enum restartStates {initial_state,
32 perform_start,
33 system_started,
34 perform_stop};
36 struct GlobalData {
37 Uint32 m_restart_seq; //
38 NodeVersionInfo m_versionInfo;
39 NodeInfo m_nodeInfo[MAX_NODES];
40 Signal VMSignals[1]; // Owned by FastScheduler::
42 Uint64 internalMillisecCounter; // Owned by ThreadConfig::
43 Uint32 highestAvailablePrio; // Owned by FastScheduler::
44 Uint32 JobCounter; // Owned by FastScheduler
45 Uint64 JobLap; // Owned by FastScheduler
46 Uint32 loopMax; // Owned by FastScheduler
48 Uint32 theNextTimerJob; // Owned by TimeQueue::
49 Uint32 theCurrentTimer; // Owned by TimeQueue::
50 Uint32 theShortTQIndex; // Owned by TimeQueue::
52 Uint32 theLongTQIndex; // Owned by TimeQueue::
53 Uint32 theCountTimer; // Owned by TimeQueue::
54 Uint32 theFirstFreeTQIndex; // Owned by TimeQueue::
55 Uint32 testOn; // Owned by the Signal Loggers
57 NodeId ownId; // Own processor id
59 Uint32 theStartLevel;
60 restartStates theRestartFlag;
61 Uint32 theSignalId;
63 Uint32 sendPackedActivated;
64 Uint32 activateSendPacked;
66 GlobalData(){
67 theSignalId = 0;
68 theStartLevel = NodeState::SL_NOTHING;
69 theRestartFlag = perform_start;
71 ~GlobalData(){}
73 void setBlock(BlockNumber blockNo, SimulatedBlock * block);
74 SimulatedBlock * getBlock(BlockNumber blockNo);
76 void incrementWatchDogCounter(Uint32 place);
77 const Uint32 * getWatchDogPtr();
79 private:
80 Uint32 watchDog;
81 SimulatedBlock* blockTable[NO_OF_BLOCKS]; // Owned by Dispatcher::
82 public:
83 ArrayPool<GlobalPage> m_global_page_pool;
84 ArrayPool<GlobalPage> m_shared_page_pool;
87 extern GlobalData globalData;
89 #define GLOBAL_TEST_ON (localTestOn)
90 #define GET_GLOBAL_TEST_FLAG bool localTestOn = globalData.testOn
91 #define SET_GLOBAL_TEST_ON (globalData.testOn = true)
92 #define SET_GLOBAL_TEST_OFF (globalData.testOn = false)
93 #define TOGGLE_GLOBAL_TEST_FLAG (globalData.testOn = (globalData.testOn == true ? false : true))
95 inline
96 void
97 GlobalData::setBlock(BlockNumber blockNo, SimulatedBlock * block){
98 blockNo -= MIN_BLOCK_NO;
99 assert((blockTable[blockNo] == 0) || (blockTable[blockNo] == block));
100 blockTable[blockNo] = block;
103 inline
104 SimulatedBlock *
105 GlobalData::getBlock(BlockNumber blockNo){
106 blockNo -= MIN_BLOCK_NO;
107 return blockTable[blockNo];
110 inline
111 void
112 GlobalData::incrementWatchDogCounter(Uint32 place){
113 watchDog = place;
116 inline
117 const Uint32 *
118 GlobalData::getWatchDogPtr(){
119 return &watchDog;
122 #endif