On 24 Mar 2006 Peter Juszack vdr@unterbrecher.de wrote:
I know that it would be possible to leave the Action mehtod via return. But I want to implement some clean up at after the action loop so the method must finish in al cases.
In that case you could leave the action loop with break. No need for another flag normaly.
I don't understand why it is not possible to set the cThread::running member to false from within the action loop or use any other cThread implemented mechnism to leave the action loop. Leaving this to the plugin developer is not the best idea beacause of duplicate running variables.
Well, I don't see the problem.
If you want to stop a thread from outside i.e. from another thread you use Cancel(), as this envolves signaling the running thread that it should shut down.
If you're on the thread i.e. inside Action() there is no need for any kind of signaling, you must only drop out of the Action() function to shut down the thread.
Regards.