1 // Copyright 2021 The Pigweed Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not 4 // use this file except in compliance with the License. You may obtain a copy of 5 // the License at 6 // 7 // https://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 // License for the specific language governing permissions and limitations under 13 // the License. 14 #pragma once 15 16 namespace pw::system { 17 18 // This function should be called after all required platform initialization is 19 // complete, but before the scheduler is started. This function WILL return so 20 // the caller may start the scheduler if needed. 21 // 22 // Init will start logging, RPC, and work queue threads, and do any 23 // initialization required for those systems. Note that this initialization is 24 // largely not synchronous: only the work queue thread is dispatched, and the 25 // remainder of the initialization is added as a work queue item so it can be 26 // run in the normal context of a running scheduler/OS. This means RPC and 27 // logging will not be fully initialized until after that first work queue item 28 // is complete. 29 // 30 // To run something after pw_system's initialization is complete, 31 // simply add a callback to the work queue after calling pw::system::Init() 32 // rather than directly calling the function itself. 33 void Init(); 34 35 } // namespace pw::system 36