Multi-threaded GUI

Simon s.d.hammett at gmail.com
Thu Jul 26 10:15:22 PDT 2012


On 26/07/2012 09:16, Russel Winder wrote:
> On Wed, 2012-07-25 at 23:17 +0200, Kagamin wrote:
>> On Wednesday, 25 July 2012 at 18:50:51 UTC, Simon wrote:
>>> You have to be very, very careful with trying to do multi
>>> threading w/ windoze windows. Try doing a google search on it,
>>> and the advice is invariably: don't do multi threaded windows.
>>> Everybody including people famous for their in-depth window
>>> knowledge recommends a single thread UI with non-UI worker
>>> threads.
>>
> So if Windows is really doing multi-threaded widget management, this
> would be very interesting.  Where is the material that I can look at
> that leads you to say that Windows is a multi-threaded UI.

On 'doze every thread can have it's own message pump and therefore it's 
own UI, but if you have an ancestor/descent relation between 2 windows 
they must belong to the same thread.

Otherwise you are pretty much guaranteed a deadlock, unless you only 
ever use MsgWaitForMultipleObjectsEx to synchronise. But that's kinda of 
unachievable unless you have written every single line of code yourself.

So you can have threads with separate UIs as long as you don't make the 
windows of one thread the child of another.

-- 
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk




More information about the Digitalmars-d mailing list