Threadmare #.NET #Delphi #dgrok
Dan Miser posted some links to articles on multithreading. I've already read "Multithreading - the Delphi Way", but "Waking from Threadmare" was new to me, so I spent a few minutes browsing through it. Methinks I'm going to have to spend some time reading it in more depth.
One interesting tidbit in "Waking from Threadmare" was a new take on null objects. The author suggests making all the public methods non-virtual, and starting each one with "if Self = nil then Exit;". Then "nil" becomes a null object — you can call methods on a nil reference, and it just works. Obviously this only works in Delphi for Win32; in other languages, or in .NET, you would have to use a proper null object. But it's still an intriguing idea.
His system for inter-thread communication looks very intriguing. It only allows status reporting, so I'm wondering how you have your thread return data when it's done (why doesn't Finish take a data object?), but it still looks well worth some more digging. It should apply to .NET, too (maybe I can use it in DGrok).