Home » U++ Library support » U++ MT-multithreading and servers » DnD hangs in MT Refresh()ing
|
Re: DnD hangs in MT Refresh()ing [message #24877 is a reply to message #24848] |
Tue, 02 February 2010 19:15 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
kohait00 wrote on Mon, 01 February 2010 08:52 | hi mirek, just to be sure:
in Win32Wnd
in Create0 and ProcessEvent
you put and left a
ASSERT(IsMainThread());
..
is that really nesseccary? cause there might be cases where another thread starts to execute a dialog, or shouldnt that happen (because thats bad design, good would be gui = main thread)
cheers
|
I believe it is ok - another thread can never execute a dialog DIRECTLY.
See explanation above - it is because all messages are associated with a thread that created the window (by Win32). That is the reason we need all that stupid machinery of "calling to the main thread" - if non-main thread wants to create a window, it is done by Call or ICall -> this puts the request for the main thread, which, when idle (event queue empty), adopts a request and performs it. Non-main thread waits blocked by semaphor, main thread releases the semaphor when request finished. That way, all windows are created by the main thread and all message loops are performed by the main thread too...
Mirek
|
|
|
|
Re: DnD hangs in MT Refresh()ing [message #24915 is a reply to message #24894] |
Thu, 04 February 2010 12:37 |
|
kohait00
Messages: 939 Registered: July 2009 Location: Germany
|
Experienced Contributor |
|
|
hi mirek,
i didn't quite get the point.. why should Start not return, it simply posts 10 tasks to the CoWork, which is not blocking normally..(not permanentl, besides accessing internals of CoWork protected by internal Critical Section).
the indicater for closinfg was the dtor of App() setting a flag, by that timethe application was dying, the threads could not comlete their Refresh.. thus not releasing GuiLock. and the dtor could not complete cause of CoWork dtor Finish() call. but why should the App dtor run in GuiLock mode??
nevertheless, here is a version using the same waiter Thread trick, recently used in my WorkQueueTest example..
this one should quit correctly..which might be a general approach of how to close/shutdown an MT application with other threads using GuiLock __;..
-
Attachment: CoWork.rar
(Size: 7.39KB, Downloaded 228 times)
|
|
|
Re: DnD hangs in MT Refresh()ing [message #24940 is a reply to message #24915] |
Fri, 05 February 2010 10:43 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
kohait00 wrote on Thu, 04 February 2010 06:37 | hi mirek,
i didn't quite get the point.. why should Start not return, it simply posts 10 tasks to the CoWork, which is not blocking normally..(not permanentl, besides accessing internals of CoWork protected by internal Critical Section).
|
CoWork destructor waits for all tasks to finish.
Besides, not all of these 10 tasks are started in the process. CoWork is loop paralelizer, it starts only as much tasks (globally!) as there is cores in CPU (well, in fact, it starts 2 more to cover 'wait for I/O' issues, but that it is).
Mirek
|
|
|
|
Goto Forum:
Current Time: Fri Mar 29 11:38:31 CET 2024
Total time taken to generate the page: 0.02369 seconds
|