Re: Threading question



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.


--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx


.



Relevant Pages

  • Re: What doesnt lend itself to OO?
    ... >>server is a pure data transfer interface. ... essentially exposing the client or service implementation. ... >>paradigms can be abstracted just like any other problem space in an OO ...
    (comp.object)
  • Re: Text terminal rendering design
    ... free to give it any object that satisfies that interface. ... giving it a real facade object if I choose. ... Facade to avoid touching the client. ... completely incompatible with this subsystem interface. ...
    (comp.object)
  • Re: Abstract public member variales?
    ... Entity has no encapsulation and no real methods, but the great thing about it is that its public interface will never have to change during maintenance. ... Assuming there is at most only one Property instance for each property type, then the R1 collection class would own the smarts for finding the right one. ... However, I would point out that the client of the getter is someone who needs to collaborate with a specific Property, not the Entity itself. ... The second line generates a message to the Property for the collaboration. ...
    (comp.object)
  • Re: Text terminal rendering design
    ... Which is exactly what would happen in your case when the interface of the implementation object changes. ... But then you need a new object to own the actual responsibility within the subsystem implementation. ... I can pop in a facade in a completely painless manner without being forced to rename or kludge anything. ... Facade to avoid touching the client. ...
    (comp.object)
  • Re: Message-based vs. method-based interaction [was: Re: LSP and subtype]
    ... interface is always the method signature. ... We can name it for the owner context of what it does or we can name it for the client context, but we can't do both. ... overlaying some sort of developer structure on the 3GL syntax. ... Such separation is impossible to do with pure 3GL language syntax. ...
    (comp.object)