Re: gdk threads ...



On 05/22/2012 04:46 PM, Michael Meeks wrote:
> 
> On Tue, 2012-05-22 at 16:07 +0200, Stef Walter wrote:
>> If you have more details/links on how VCL gets around this, I'd be
>> interested. A bit of a morbid curiosity perhaps :P
> 
> 	Sure; here is some of it:
> 
> http://cgit.freedesktop.org/libreoffice/core/tree/vcl/win/source/window/salframe.cxx#n1023
> 
> 	Grok for ImplSendMessage I guess, lots of it is synchronous to the main
> thread. Those messages are handled here:
> 
> http://cgit.freedesktop.org/libreoffice/core/tree/vcl/win/source/app/salinst.cxx#n732
> 
> 	Some boring stuff there for sure, but only ~70 lines of it.

Interesting.

That's an okay approach if you make sure all Win32 windows (and DC's and
so on) are created explicitly in your code and not via other APIs.

FWIW, g_main_context_invoke() + g_main_context_acquire() can be used to
create a function with similar behavior as SendMessage. That is, it
invokes its callback directly if running within the main thread, and if
not invoke it as an idle and, then wait for the results using a GCond.
So there's not a big performance hit for code running in the main thread.

Cheers,

Stef


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]