Given a threads TID, add the ability to cancel that thread from any thread with the same parent process. Sometimes there is a need to stop a thread and exceptional conditions within some quite large code prevents the thread from terminating despite my best programming efforts to flag it to terminate. A way to forcefully cause a thread to terminate would be fantastic. Thank you, -Mark
Anonymous
Mark, can you elaborate?
What kind of threads would you like to kill?
ooRexx-created threads, e. g. from a REPLY?
Or user-threads which attach to an interpreter instance?
How would your program figure out the required TID?
The parent process would be the process ooRexx is running in?
Will your scenario apply to all operationg systems (Windows, Linux, Darwin, OpenBSD, Android etc)?
Do you have a use case scenario, or a short piece of code that demonstrates, when/how this would be beneficial?
Erich, the threads I need to kill are my "console objects" which are threads started by REPLY (as you indicated). I'd assumed that these threads could query their own TID via SysQueryProcess("TID") and store it somewhere (i.e. .local["console1"]) so the main process could access it if needed. These consoles threads are started when a network administrator telnets into the system and each thread handles one user console. Sometimes a TCP connection will drop or the idle timeout will expire and the connection is closed. However sometimes, albeit rarely, a thread will hang and not terminate in spite of my efforts to get it to stop cleanly. I think they're waiting on input from the socket, but I'm not sure because I can never get one to hang when I'm trying to debug it!
In this case, I have the TID for "console1" available, so I'd issue "SysKillThread(tid)" or something similar to cause the thread in question to be forcibly terminated.
So, to answer your questions directly:
Thank you! -Mark
Last edit: Mark Harsen 2017-10-31