[RTOS] global instances by moving the "create" things into a "start" method?

19 Dec 2014

Hi there!

I did some tests with the RTOS and want to use it for future projects. But I don't like, that all initial stuff (like creating threads and timers) is done in the constructor.

I prefer global static instances of e.g. Serial PC(USBTX, USBRX); DigitalOut led1(LED1); char rxBuffer[512]; ... So the compiler can calculate the needed RAM far better. See "Program Details" -> "Build" -> "Memory usage". Why not doing the same with the RTOS classes?

Some days ago I moved the "osTimerCreate" call from RtosTimer constructor to RtosTimer::start and this works. No additional method call is expected from the user.Then did a pull-request, so the official mbed-rtos can publish that change. But nothing happened :(

The Thread class has no start method, but I'd like to have one. So even this class can be instanciated global, but started dynamically.

What do you think about?