| 14 | static const char* TAG = "Thread"; |
| 15 | |
| 16 | struct Thread { |
| 17 | TaskHandle_t taskHandle = nullptr; |
| 18 | ThreadState state = THREAD_STATE_STOPPED; |
| 19 | thread_main_fn_t mainFunction = nullptr; |
| 20 | void* mainFunctionContext = nullptr; |
| 21 | int32_t callbackResult = 0; |
| 22 | thread_state_callback_t stateCallback = nullptr; |
| 23 | void* stateCallbackContext = nullptr; |
| 24 | std::string name = "unnamed"; |
| 25 | enum ThreadPriority priority = THREAD_PRIORITY_NORMAL; |
| 26 | struct Mutex mutex = { 0 }; |
| 27 | configSTACK_DEPTH_TYPE stackSize = 4096; |
| 28 | portBASE_TYPE affinity = -1; |
| 29 | |
| 30 | Thread() { |
| 31 | mutex_construct(&mutex); |
| 32 | } |
| 33 | |
| 34 | ~Thread() { |
| 35 | mutex_destruct(&mutex); |
| 36 | } |
| 37 | |
| 38 | void lock() { mutex_lock(&mutex); } |
| 39 | |
| 40 | void unlock() { mutex_unlock(&mutex); } |
| 41 | }; |
| 42 | |
| 43 | static void thread_set_state_internal(Thread* thread, ThreadState newState) { |
| 44 | thread->lock(); |
no outgoing calls
no test coverage detected