Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ MT-multithreading and servers » DnD hangs in MT Refresh()ing
Re: DnD hangs in MT Refresh()ing [message #24848 is a reply to message #24780] Mon, 01 February 2010 14:52 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
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
Re: DnD hangs in MT Refresh()ing [message #24877 is a reply to message #24848] Tue, 02 February 2010 19:15 Go to previous messageGo to next message
mirek is currently offline  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 #24894 is a reply to message #24877] Wed, 03 February 2010 12:32 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Hey, I believe I have found why that CoWork test does not work...

It is SO twisted and obvious... Obviously, the main issue is that "Start" routine NEVER RETURNS (because it waits for all iterations to finish).

That means it effectively stops the timer queue...

Mirek
Re: DnD hangs in MT Refresh()ing [message #24915 is a reply to message #24894] Thu, 04 February 2010 12:37 Go to previous messageGo to next message
kohait00 is currently offline  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 Go to previous messageGo to next message
mirek is currently offline  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
Re: DnD hangs in MT Refresh()ing [message #25033 is a reply to message #24940] Mon, 08 February 2010 21:55 Go to previous message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
this multithreading stuff can drill a hole in the brain Smile
thanks for help...
Previous Topic: MT with speed optimization fails
Next Topic: what about WorkQueue : public CoWork
Goto Forum:
  


Current Time: Thu Mar 28 13:23:28 CET 2024

Total time taken to generate the page: 0.01035 seconds