|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: Amar (Amarjeet.singh
KLA-TENCOR.COM)Date: Fri Mar 08 2002 - 10:46:42 CST
Hi Rune,
This is also a endless loop and quit message can't be used because that
crashes the application as application window crashes.
-----Original Message-----
From: Distributed COM-Based Code [mailto:DCOM
DISCUSS.MICROSOFT.COM]On
Behalf Of Rune Christensen
Sent: Friday, March 08, 2002 9:47 PM
To: DCOM
DISCUSS.MICROSOFT.COM
Subject: Re: Thread hangs when It tries to Call GetInterfaceFromGlo bal
Sorry. Forgot the very important Sleep()... see inline
-----Original Message-----
From: Rune Christensen [mailto:rc
RUBICON.NO]
Sent: 8. mars 2002 17:15
To: DCOM
DISCUSS.MICROSOFT.COM
Subject: Re: Thread hangs when It tries to Call GetInterfaceFromGlo bal
GetMessage doesn't return before you receive a message.
Either let last thread execute PostThreadMessage(idMainThread, WM_QUIT, 0,
0 ) (don't need iAllThreadDied anymore.
Or, Use PeekMessage() and Sleep() instead of GetMessage()
Or, let all threads post any message after incrementing iAllThreadDied
Or, ...
E.g something like:
MSG msg;
iAllThreadDied = 0;
bool quit= false;
while( !quit )
{
Sleep(100);
while ( PeekMessage( &msg, 0, 0, 0, PM_NOREMOVE ) )
{
if ( GetMessage(&msg, 0, 0, 0)) )
{
DispatchMessage(&msg);
}
else
{
quit= true; // If you want to quit on WM_QUIT
break;
}
}
if(iAllThreadDied ==32)
quit= true;}
}
Regards,
Rune C
-----Original Message-----
From: Amar [mailto:Amarjeet.singh
KLA-TENCOR.COM]
Sent: 8. mars 2002 17:07
To: DCOM
DISCUSS.MICROSOFT.COM
Subject: Re: Thread hangs when It tries to Call GetInterfaceFromGlo bal
Phil,
I am not able to get out og message pump.
Here is the code
MSG msg;
iAllThreadDied = 0;
while (GetMessage(&msg, 0, 0, 0))
{
DispatchMessage(&msg);
if(iAllThreadDied ==32)
break;
}
::WaitForMultipleObjects (32,phThirtyTwoThreads,true,INFINITE);
Here all threads update global variable and still getmessage hangs
your suggestions please.
Amar.
....
snipped
....
----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html .
To unsubscribe, mailto:DCOM-signoff-request
DISCUSS.MICROSOFT.COM
----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html .
To unsubscribe, mailto:DCOM-signoff-request
DISCUSS.MICROSOFT.COM
----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html .
To unsubscribe, mailto:DCOM-signoff-request
DISCUSS.MICROSOFT.COM
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]