[Lazarus] Even more radical suggestion regarding Event Queues
Henry Vermaak
henry.vermaak at gmail.com
Fri Jan 21 13:49:23 CET 2011
On 21/01/11 12:36, Michael Schnell wrote:
> On 01/21/2011 01:05 PM, Henry Vermaak wrote:
>>
>> As I've said in the bug report, I call
>> g_main_context_wakeup(g_main_context_default) myself to wake up the
>> loop. This works perfectly, but is obviously suboptimal, since it need
>> to be inside an ifdef.
> Am I wrong assuming that WakeUpMainThread (which is a defined as
>
> var
> { method proc that is called to trigger gui thread to execute a method }
> WakeMainThread : TNotifyEvent = nil;
>
> ) in fpc's classes.inc, thus something provided independent of the
> underlying Widget Type should be used for that purpose ?
>
> I understand that in the initialization phase this variable somehow is
> filled with the address of a procedure that (depending on the underlying
> Widget Type), is supposed to do what is necessary.
Yes. Look at TGtk2WidgetSet.InitSynchronizeSupport in
gtk2widgetset.inc. It creates a pipe, which gets watched by the main
loop. PrepareSynchronize then just writes something to the pipe, which
wakes up the main func via the watched pipe. Or so the theory goes. I
haven't really looked into it more closely.
Henry
More information about the Lazarus
mailing list