http://www.interact-sw.co.uk/iangblog/2005/05/16/endinvokerequired
One more reason to jump to .net 3.5 somewhere in the future:
- http://www.vsj.co.uk/articles/display.asp?id=704
- http://msdn.microsoft.com/en-us/magazine/cc163340.aspx
- http://channel9.msdn.com/posts/DanielMoth/ParallelFX-Task-and-friends/
- http://channel9.msdn.com/posts/JeffBarnes/Parallel-Extensions-for-the-NET-Framework-ParallelFX/
I tried to implement thread-based map rendering so that it will re-start rendering. Useful to use when rendering takes >1 sec. With low-level threads it sounds a bit more complicated, plus .NET implementation seems to be a bit unstable when you call Abort() on a worker thread, something happens with context of a thread and application becomes unusable . Similar experience is explained here by Sacha Barber:
- http://www.codeproject.com/KB/threads/ThreadingDotNet.aspx
- http://www.codeproject.com/KB/threads/ThreadingDotNet2.aspx
Finally I implement it using BackgroundWoker which is actually a wrapper around Thread and now it seems to work stable. Have a look on MapControl.Refresh() to see details.
Also during implementation calls to Controls via InvokeRequired attribute stopped working, application hangs, I made it work by splitting Invoke() call into InvokeBegin() and then InvokeEnd() in a separate thread. Maybe a bit costly but seems to work fine. See InvokeRequiredAttribute.cs
Here is also a nice video about future way to run parallel + worker work in a separate threads: