I have a program running 2 threads; occasionally the main thread stalls and the worker thread is leaft as an orphan.
How do I close / terminate this orphan thread?
I tried putting a simple time check in the worker thread forcing it to return after a certain elapsed time ( of zero activity from the main thread). But i still suspect the orphan thread is running.
1) Is there a way to check if a thread is still active?
2) Is it necessary to do more than simply return from a thread function to terminate the worker thread? ( after all an orphan has nowhere to return to)
I am Running Ubuntu Linux 12.04, and using NetBeans as the IDE + latest Java.