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.
11 years, 11 months ago.
Stopping the operation of a thread
Hello,
I would like to know which command is used to stop the operation of a thread. Use two thread in my program, and specific points of my program, I would kill them.
Thank you. Carlos Alberto.
Question relating to:
5 Answers
6 years, 8 months ago.
Does exists any way to terminate running thread from another running thread?
THX.
11 years, 8 months ago.
Hey Carlos. I have the same problem. I want to start executing a function in a thread and also be able to restart (stop and start it again) the same function executing also in a thread, doing it e.g for 50 times.
Actually i create and strat my thread by new-operator (pointer) and after executing or after using the terminate-method i kill the stuff with delete. The problem is i am able to do this just for 11 times (although the maximum number of useable threads is set to 7 in rtos library). After 11th execution i cant create a new thread.
So, how have you solved your software problem?
Maybe here is someone other who can help me?
Regards.
Andreas
Hi Andreas,
I solved my problem by managing the shared use of a single resource (serial port). View in: Mutex -> https://mbed.org/handbook/RTOS
I could not stop and start the tread.
Sorry for the lack of response!
Best Regards.
Carlos Alberto
posted by 12 Mar 201311 years, 11 months ago.
Hi Carlos,
Take a look at the terminate method:
your_thread_1.terminate()
Cheers, Sam
11 years, 11 months ago.
Ok, your_thread_1.terminate (), kills the thread.
And to return to run again?
Thank You. Carlos Alberto.