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 15 #define PW_LOG_MODULE_NAME "SYS" 16 17 #include "pw_log/log.h" 18 #include "pw_system/init.h" 19 #include "pw_thread/sleep.h" 20 #include "pw_thread/thread.h" 21 #include "pw_thread_stl/options.h" 22 23 namespace pw::system { 24 LogThreadOptions()25const thread::Options& LogThreadOptions() { 26 static thread::stl::Options log_thread_options; 27 return log_thread_options; 28 } 29 RpcThreadOptions()30const thread::Options& RpcThreadOptions() { 31 static thread::stl::Options rpc_thread_options; 32 return rpc_thread_options; 33 } 34 WorkQueueThreadOptions()35const thread::Options& WorkQueueThreadOptions() { 36 static thread::stl::Options work_queue_thread_options; 37 return work_queue_thread_options; 38 } 39 40 } // namespace pw::system 41 main()42extern "C" int main() { 43 pw::system::Init(); 44 // Sleep loop rather than return on this thread so the process isn't closed. 45 while (true) { 46 pw::this_thread::sleep_for(std::chrono::seconds(10)); 47 // It's hard to tell that simulator is alive and working since nothing is 48 // logging after initial "boot," so for now log a line occasionally so 49 // users can see that the simulator is alive and well. 50 PW_LOG_INFO("Simulated device is still alive"); 51 // TODO(amontanez): This thread should probably have a way to exit. 52 } 53 } 54