Hi,

Can anyone tell me, what are common reasons why threads hang around and stop a program from exiting once all its work is done? I have the following situation:

1. Main thread calls a method, which starts up a thread to do stuff, and sets up a listener for certain events

2. The listener informs the main thread once its work is complete

3. Main thread sleeps until it hears from the listener that the new thread's work is finished

4. Main thread does some more work and then exits

At this point I would expect the program to exit, but it doesn't.

I should point out that I don't know the internals of what the new thread is doing, that code is hidden from me. This is all in the context of communicating using JSR-82 for Bluetooth; I am using the Avetana implementation. Their technical support guy to whom I've been talking says he is unable to duplicate the problem. I find this disturbing, because the starting point for my code was the sample code he's testing.

And then another question: where do most people learn how to use threads properly? I've been "taught" threading - but all that involved was learning how to create threads; there was nothing about where to use what, how to avoid deadlock etc. Also nothing specific to Java - only C/C++ for an operating systems course.

Fritz


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CTJUG Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/CTJUG-Forum
For the ctjug home page see http://www.ctjug.org.za
-~----------~----~----~----~------~----~------~--~---

Reply via email to