Clone of mbed rtos 2 for easy accessibility.
Fork of mbed-rtos by
Diff: rtos/Thread.cpp
- Revision:
- 48:e9a2c7cb57a4
- Parent:
- 40:bd07334df5b1
- Child:
- 59:28712e303960
diff -r 65a1b2fc9a51 -r e9a2c7cb57a4 rtos/Thread.cpp --- a/rtos/Thread.cpp Mon Nov 03 10:30:24 2014 +0000 +++ b/rtos/Thread.cpp Thu Nov 06 11:00:33 2014 +0000 @@ -31,6 +31,7 @@ _thread_def.pthread = task; _thread_def.tpriority = priority; _thread_def.stacksize = stack_size; +#ifndef __MBED_CMSIS_RTOS_CA9 if (stack_pointer != NULL) { _thread_def.stack_pointer = stack_pointer; _dynamic_stack = false; @@ -41,6 +42,7 @@ _dynamic_stack = true; } #endif +#endif _tid = osThreadCreate(&_thread_def, argument); } @@ -61,7 +63,13 @@ } Thread::State Thread::get_state() { +#ifndef __MBED_CMSIS_RTOS_CA9 return ((State)_thread_def.tcb.state); +#else + uint8_t status; + status = osThreadGetState(_tid); + return ((State)status); +#endif } osEvent Thread::signal_wait(int32_t signals, uint32_t millisec) { @@ -82,9 +90,11 @@ Thread::~Thread() { terminate(); +#ifndef __MBED_CMSIS_RTOS_CA9 if (_dynamic_stack) { delete[] (_thread_def.stack_pointer); } +#endif } }