Thread life cycle question.
1 posts in topic
Flat View  Flat View

Posted By:   Cory_Powers
Posted On:   Monday, July 23, 2001 05:32 AM

I have a Java application that starts a new thread to read data on a Serial Port. The main application is registered as an event listener on the thread that is reading the data. After the application loads the DataReceiver thread it will exit its main method, which should terminate the main application thread.

What do I need to do to ensure the events are received from the DataReceiver in the main thread?

Re: Thread life cycle question.

Posted By:   Alex_Chaffee  
Posted On:   Monday, July 23, 2001 12:09 PM

If the main thread has quit, then it can't receive any events.

Probably you will register some other object as a listener. This object will have its event handler methods invoked from inside the DataReceiver thread. If you don't want this, then spawn another thread to do the invocation from inside your DataReceiver object.

Sounds like you may need a refresher course on thread basics.

About | Sitemap | Contact