dcsimg
how can I pass objects to a thread that is already running ???
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ariel_Romero
Posted On:   Friday, August 22, 2008 04:43 PM

Hi everybody:

I would like to know how can I pass objects to a thread that is already running, I need this because I want that a thread proccess some information and after processing it, this thread passes this object information to another thread that will make another tasks, this way I make the application be more efficiently.
Could you help me please.
I would thanks any help.
Greetings
Ariel

Re: how can I pass objects to a thread that is already running ???

Posted By:   Stephen_McConnell  
Posted On:   Sunday, August 24, 2008 01:24 PM

I think the concept of "running" is what you have a problem with. It would be difficult to pass information to code that is in the process of executing. That code must be interrupted to pass a parameter to it. Either by the thread itself or a thread controller.


When you create a thread, you are creating an Object that has the inherited properties of a Thread. You must stop the thread, pass the parameter to the thread via some method you have put on the thread and then restart it to get it to work with the new parameter.


If it comes to the point in the threads execution that it needs the parameter, the thread should recognize it, stop, send a request to some code to put the parameter there and restart. OR if a parameter changes, the thread controller should stop the thread, put the parameter there and restart.


I may be wrong, but at least that is the way I do it, because otherwise you have stuff changing willy nilly.

Re: how can I pass objects to a thread that is already running ???

Posted By:   Amit_Mahajan  
Posted On:   Saturday, August 23, 2008 08:21 AM

if thread is running only then you can pass object to that thread, else you wont be able as it is not running,

any running thread must have some running method , that will have a signature and input params that can pick any object as it wish.(y so confused)
About | Sitemap | Contact