Are you sure this would make things easier? Code in the handler needs to be thread safe. Starting a thread is very easy, with TThread?
If you use common resources of course you do need to take create to do it in a thread save way.

But if you want to off-load some kind of work to one or more threads you need to do the communication - especially notifications between the threads - in a way everybody needs to invent for himself. Mostly you will (or even need to) use non-portable methods (Windows-Messages) for that. I always feel that it's not "nice" that when doing a thread you can't use event-driven programming (as everybody does in the main thread), but need to do your own work-loop per thread. (I do know that modifying this would be a _major_ RTL enhancement. So I'm not suggesting to start working on that right here. I'm just thinking about a means to integrate it into the language at a future point in time.)

Some predefined, portable and easy to understand (i.e. very similar to main-thread programing) way to work with threads would be a nice enhancement over what any other Delphi-Language successor provides right now. Here I can imagine extending Events (including may those of the standard libraries provide) to working as threads could be a way to go.

Or do you mean you want something like work queues?
Supposedly some queuing mechanism needs to be used to provide parameters to the thread and to pass results back to the program that defined the event would be used.

-Michael
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to