Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 11 months ago.
question about the RTOS member function get_state()
It can only be called from a running task, so it will always return "Running". Seems like a useless function. What am I missing?
1 Answer
6 years, 11 months ago.
I don't know that I really have an answer, but get_state() is a public member function so get_state() can be called by the module that created/owns the Thread. So if you create a Thread my_thread, in main(), you can call my_thread.get_state() from main(). Obviously if you call it from main(), my_thread will never be in the running state at the point when you get the state. How would you put this function to practical use? I'm not sure I can say.