[Lazarus] FPC 2.6.2 + Thread.Queue?

Michael Van Canneyt michael at freepascal.org
Wed Apr 24 13:03:38 CEST 2013



On Wed, 24 Apr 2013, Michael Schnell wrote:

> On 04/24/2013 12:34 PM, Michael Van Canneyt wrote:
>> ยด
>> What are you waiting for ?
>> 
>> All you need to do is implement an event loop. All the rest is there.
>> 
>> 
> As I said, I already did try this some years ago Trying both to implement a 
> new event queue mechanism (stolen from mse), and - better idea - reusing the 
> event queue code from the "GTK" WidgetType. But I gave up after some weeks 
> (not fulltime, of course)  due to the enormous complexity of the Lazarus 
> units involved.
>
> In fact I did only take a look  at the Lazarus units, not the RTL, at that 
> time not knowing that it would need to be revised, too.
>
> A major political problem is that - to do it right - all WidgetType units 
> that are dealing with the EventQueue would need to be modified (e. g. using 
> the new RTL interface and moving QueueAsncCall out), and of course the basic 
> work needs to be done in the RTL (e. g providing the "SignalMainThread" 
> interface with an EventQueue that is to  be used for non-GUI events (and be 
> merged with the GUI events from the LCL at the queue input (GTK and many 
> others) or the queue output (Windows) and moving QueueAsncCall in).
>
> This would need a huge testing effort to guarantee  that existing code would 
> not be broken.
>
> All this can't be done by a one-man team of volunteers.

Of course it can.

You make the task far too complex. Start by NOT looking at the LCL code.

You need simply to start with

TCustomEventLoopApplication = Class(TCustomApplication)
// Whatever
end;

Which abstracts the event loop.

Then you implement a

TConsoleEventLoopApplication = class(TCustomEventLoopApplication)
// Whatever
end;

which implements the event loop for console apps using whatever mechanism you see fit. 
You could e.g. make use of libevent which provides a ready-to-go event loop.

This will demonstrate that your concept works.

After that, the remaining task is to make sure that TApplication from the 
LCL can be built on top of TCustomEventLoopApplication. I'm sure this will 
not take too long.

All this is perfectly doable for 1 person.

Michael.


More information about the Lazarus mailing list