Hello!
I have a question about os_tsk_delete() function from keil. I am wondering what happens to task's stack when you call the delete function. Does it unwinds like normal functions when they return?
A little bit of info why I am asking. I was wondering what happens if I have a task, that has a class inside it like so:
class A { ~A(); } __task void taskFunction(void *argv) { A a; while(true); }
Now lets say I delete the task by using os_tsk_delete() function. Does the destructor of class A get called?
Thanks in advance for any useful information!
No. It just kills the task immediately. Bang. Gone. Kaput. Toasted. Kicks the bucket.
Send a message to the task, requesting it to exit on its own. Then let the task end the execution loop, destroy any objects and then destroy itself. That is the only way you will be able to have a thread make a serious attempt at cleaning up consumed resources before it exists.