Threading question

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

I have some difficulties understanding some issues with multithreading:

*What is the meaning of: "implement a method to run each update call in
its own thread"
*If i have a component that does an AsynchronousCallBack that will pass
data to the client, which thread will process the data, the caller or
the client ?
*How can know which thread is doing that
*If i want to update a user interface it has to be done on the thread
that created the UI. ?
*If i have a threadpool that call a method on the client (via an
interface), who's thread is doing what ? And how can i do to have a
server thread that notify and a client thread that process so it's not
blocking...

Thanks to help with those issues or point me some interesting link

Thanks
John
 
John,

See inline:

*What is the meaning of: "implement a method to run each update call in its
own thread"

To me, this would mean that the code that is run on a separate thread is
kept in a single method, and then that method is passed to a Thread
instance, or to the QueueUserWorkItem method on the ThreadPool class.

*If i have a component that does an AsynchronousCallBack that will pass data
to the client, which thread will process the data, the caller or the client
?

The caller thread is the thread that the AsychronousCallBack is called
on (assuming this is just a regular call from another thread, and not a
BackgroundWorker instance).

*How can know which thread is doing that

Is doing what? You mean making callbacks and firing events? Typically,
the thread that is triggering the events is going to be the thread that
event handlers and callbacks are called on.

*If i want to update a user interface it has to be done on the thread that
created the UI. ?

Yes, this is correct.

*If i have a threadpool that call a method on the client (via an interface),
who's thread is doing what ?

This is the same as before, the threadpool thread is firing the events,
so the interface is being called on the thread from the threadpool.

*And how can i do to have a server thread that notify and a client thread
that process so it's not blocking...

You will have blocking on some level if you are waiting for something,
or you will have to poll for the results. Basically, you would have another
thread make a blocking call, and then when the call returns, you can notify
the UI thread.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top