MCPcopy Create free account
hub / github.com/DISTORTEC/distortos / lowLevelInitializer

Method lowLevelInitializer

source/scheduler/MainThread.cpp:130–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128+---------------------------------------------------------------------------------------------------------------------*/
129
130void MainThread::lowLevelInitializer()
131{
132#ifdef DISTORTOS_MAIN_THREAD_CAN_RECEIVE_SIGNALS
133
134 auto& mainThreadStaticSignalsReceiver =
135 *new (&mainThreadStaticSignalsReceiverStorage) MainThreadStaticSignalsReceiver;
136 const auto mainThreadStaticSignalsReceiverPointer = &static_cast<SignalsReceiver&>(mainThreadStaticSignalsReceiver);
137
138#else // !def DISTORTOS_MAIN_THREAD_CAN_RECEIVE_SIGNALS
139
140 // nullptr - reception of signals is disabled for main thread
141 constexpr auto mainThreadStaticSignalsReceiverPointer = nullptr;
142
143#endif // !def DISTORTOS_MAIN_THREAD_CAN_RECEIVE_SIGNALS
144
145 auto& mainThread = *new (&mainThreadStorage) MainThread {DISTORTOS_MAIN_THREAD_PRIORITY,
146 mainThreadGroupControlBlock, mainThreadStaticSignalsReceiverPointer};
147 getScheduler().initialize(mainThread.getThreadControlBlock()); /// \todo error handling?
148 mainThread.getThreadControlBlock().switchedToHook();
149}
150
151BIND_LOW_LEVEL_INITIALIZER(10, &MainThread::lowLevelInitializer);
152

Callers

nothing calls this directly

Calls 2

switchedToHookMethod · 0.80
initializeMethod · 0.45

Tested by

no test coverage detected