On 31/01/12 06:57, zeljko wrote:
 > You must be the owner of a context before you can call

 > g_main_context_prepare(), g_main_context_query(),

 > g_main_context_check(), g_main_context_dispatch().

 >

 > But none of those functions are called anywhere. What's going on here?


Why do you think they aren't called ?

I grepped the sources for g_main_context_ and none of the above functions were called, hence my conclusion that acquiring the context shouldn't be necessary. This conclusion is based on the documentation, though, perhaps it is needed for some other reason.

 > I can see that the message queue can get pretty screwed up when

 > someone uses PostMessage.


No, PostMessage works fine. I've tested it with an "heavy" app which
posts messages from another threads and updates various controls (works
same as with win32 or qt), and it DOES NOT work when using old approach.

There still is and always was a race. Even if you ignore the race, it may not even lock anything, so the "lock" name is misleading. If another thread calls lock, but another thread has the lock, it won't even block until it can acquire the lock (as I said above, g_main_context_acquire returns immediately and this code doesn't even check the return value).

Henry

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to