Friday, July 23, 2004

Idea - thRAD!

This idea is a collaboration between a collegue (Jon Roder) and myself. With any luck we can actually realise it!

Jon's an expert on threads in Delphi, and has put together a special thread class which has its own message processing loop. This is a good thing in windows, it gets around the fundamental mismatch between the Windows application model and the multithreaded process model.

I'm a big fan of RAD in the Delphi environment, and have had the idea of creating a component which kicks off a new thread for you, and instantiates a RAD developed object collection (eg: a Datamodule with design time components on it) in the context of that thread. Using Jon's message-queue enabled threads for this job lets these datamodules run in their own threads and receive windows messages, which is extremely powerful. Throw in a few components for really simple inter-thread communication (object queues going from one thread to another, object "sacks" which are mutex protected, etc) and you get an awesome, very close to zero code, multi-threaded application library.

So if, for example, you've got a GUI being managed by the main VCL thread, but you want to do database communication in another thread (because it might be slow), and you need a safe way to communicate with the main thread, this library of components would enable you to do it in minutes in a drag and drop fashion. That, my friends, is the shit!

It's threads, it's RAD, it's thRAD, and it's coming soon...

0 Comments:

Post a Comment

<< Home