S
sb534dan
I've always found it beneficial that win form component events always
callback into the UI thread (as oppose to a worker thread). The UI
client code is never exposed to the worker thread. I find this very
desirable, as this prevents resource sharing problems from within the
callback method. This guarantees that all of the client code runs
within its own thread.
With the upcoming release of .NET 2.0, various classes have been
introduced to aid in the development and usage of components providing
asynchronous operations. This is great for components (classes
implementing IComponent or deriving from System.Component). But for
normal (non component) classes, this functionality isn't provided.
When implementing the traditional .NET async pattern for normal classes
(
http://msdn.microsoft.com/library/d...ml/cpconasynchronousdesignpatternoverview.asp
), the callback is always run in a worker thread context. Therefore,
exposing the client code to a different thread.
I've considered implementing similar functionality to the .NET 2.0
component async functionality, but for normal classes. To do this. A
queue would have to be introduced for every thread in a program.
(Something akin to a traditional windows message queue).
This, I feel would eliminate the need for my class to expose its worker
thread to the client.
I'd love to hear any comments on this. My reasoning and potential
implementation maybe flawed. But I really would like an overall
opinion.
Dan.
callback into the UI thread (as oppose to a worker thread). The UI
client code is never exposed to the worker thread. I find this very
desirable, as this prevents resource sharing problems from within the
callback method. This guarantees that all of the client code runs
within its own thread.
With the upcoming release of .NET 2.0, various classes have been
introduced to aid in the development and usage of components providing
asynchronous operations. This is great for components (classes
implementing IComponent or deriving from System.Component). But for
normal (non component) classes, this functionality isn't provided.
When implementing the traditional .NET async pattern for normal classes
(
http://msdn.microsoft.com/library/d...ml/cpconasynchronousdesignpatternoverview.asp
), the callback is always run in a worker thread context. Therefore,
exposing the client code to a different thread.
I've considered implementing similar functionality to the .NET 2.0
component async functionality, but for normal classes. To do this. A
queue would have to be introduced for every thread in a program.
(Something akin to a traditional windows message queue).
This, I feel would eliminate the need for my class to expose its worker
thread to the client.
I'd love to hear any comments on this. My reasoning and potential
implementation maybe flawed. But I really would like an overall
opinion.
Dan.