} #if PLATFORM_THREADING // This is the application loop ActiveObject. void app_thread_idle() { app_loop(true); } // don't wait to get items from the queue, so the application loop is processed as often as possible // timeout after 3000 ms to put calls into the application queue, so the system thread does not deadlock (since the application may also // be trying to put events in the system queue.) ActiveObjectCurrentThreadQueue ApplicationThread(ActiveObjectConfiguration(app_thread_idle, 0, 5000)); #endif extern "C" void system_part2_post_init() __attribute__((weak)); // this is overridden for modular firmware void system_part2_post_init() { } /******************************************************************************* * Function Name : main. * Description : main routine. * Input : None. * Output : None.
#include "system_threading.h" #include "system_task.h" #include <time.h> #include <string.h> #if PLATFORM_THREADING void system_thread_idle() { Spark_Idle_Events(true); } ActiveObjectThreadQueue SystemThread(ActiveObjectConfiguration(system_thread_idle, 100, /* take timeout */ 0x7FFFFFFF, /* put timeout - wait forever */ 50, /* queue size */ 3*1024 /* stack size */)); /** * Implementation to support gthread's concurrency primitives. */ namespace std { #if 0 /** * Imlementation of conditional varaible in terms of the HAL. This has * a potential race condition due to the placement of the critical section, * so has been commented out. https://github.com/spark/firmware/pull/614#discussion-diff-39882530 */ condition_variable::~condition_variable()