S
sasha
Jon, it's be nice if you would update your Multi-threading in .NET
article using 3.5 features.
Thanks
article using 3.5 features.
Thanks
sasha said:Jon, it's be nice if you would update your Multi-threading in .NET
article using 3.5 features.
I don't know of many new features in .NET 3.5 with respect to
threading, to be honest. There's plenty I'd like to do in terms of
BackgroundWorker, and I suppose the examples could use C# 3.0 features
such as lambda expressions, but what were you particularly thinking of
from .NET 3.5?
I don't know when I'll get round to it, to be honest - it would be nice
to do, but I'm pretty busy![]()
more graceful exit of the background thread. Any provision for
synchronizing the abort so the threaded process can organize file
closes, etc.?
Marc Gravell said:I'm fairly certain nothing has changed in those areas. And even if it
had, it would most likely be ".NET 2.0 SP {x}", rather than .NET 3.5
itself. Re "synchronizing the abort" - I'm not entirely sure what you
mean, but you can subscribe to RunWorkerCompleted, which will fire (on
success, cancellation or failure, which you can determine from the
event-args) on the UI thread.
Marc
your DoWork event handler. Instead, communicate to the user interface
through the ProgressChanged and RunWorkerCompleted events."
Marc Gravell said:Or through suitable use of Control.Invoke; but yes: ProgressChanged and
RunWorkerCompleted make life a lot easier.
Actually, in debug it *might* tell you about the problem (cross-thread
etc) - but only if you get lucky ;-p
And if it fails, it won't do it completely silently: it will raise
RunWorkerCompleted with an argument that contains an exception.
Marc