|
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:06:39 CST
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.
-----Original Message-----
From: Distributed COM-Based Code [mailto:DCOM
DISCUSS.MICROSOFT.COM]On
Behalf Of Dan Longley
Sent: Friday, March 08, 2002 7:46 AM
To: DCOM
DISCUSS.MICROSOFT.COM
Subject: Re: Thread hangs when It tries to Call GetInterfaceFromGlo bal
No, that isn't true. Inbound method invocations to the MTA are completed
on threads from a pool that COM maintains.
In any case, COM threads should call CoWaitForMultipleHandles when they
need to wait. The CoWaitForMultipleHandles API checks the calling
thread's apartment type and either pumps a message loop (for an STA
thread) or calls WaitForMultipleObjects (for an MTA thread).
D
-----Original Message-----
From: Mike Sandersenus [mailto:msandersenus
YAHOO.COM]
Sent: Thursday, March 07, 2002 4:11 PM
To: DCOM
DISCUSS.MICROSOFT.COM
Subject: Re: Thread hangs when It tries to Call GetInterfaceFromGlo bal
--- Phil Reynolds <preynolds
RIDGEWAYSYSTEMS.COM>
wrote:
> The thread that put the object in the table must
> pump messages.
Is that true if the thread that put the object in the
table is a thread running in the mta?
>
>
---------------------------------------------------------
> Phil Reynolds
> Ridgeway Systems and Software
> Tel: +44 118 938 1211
> Fax: +44 118 935 4444
> mailto:preynolds
ridgewaysystems.com
> http://www.ridgewaysystems.com
>
>
> > -----Original Message-----
> > From: Amar [mailto:Amarjeet.singh
KLA-TENCOR.COM]
> > Sent: 07 March 2002 10:35
> > To: DCOM
DISCUSS.MICROSOFT.COM
> > Subject: [DCOM] Thread hangs when It tries to Call
> > GetInterfaceFromGlobal
> >
> >
> > Hi All
> > When I try to get back interface pointer from
> global table in
> > another thread
> > the threads hangs.
> > This is the main thread which registers interface
> in global table:
> >
> > MainThread{
> > DWORD* pdwCookie= new DWORD;
> > // Test
> > MSXML2::IXMLDOMDocumentPtr
> spTest(__uuidof(MSXML2::DOMDocument40));
> > hrResult = ::CoCreateInstance
> (CLSID_StdGlobalInterfaceTable,NULL,
> >
>
CLSCTX_INPROC_SERVER,IID_IGlobalInterfaceTable,(void**)&m_pGlobal);
> > hrResult = m_pGlobal->RegisterInterfaceInGlobal
> > (spTest,__uuidof(MSXML2::DOMDocument40),
> pdwCookie);
> > dw = *pdwCookie;
> > phEightThreads[iEightThreads - 1] =
> > ::CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)
> > ExcelThreadProcSendJob,(LPVOID )pdwCookie,0,0);
> > pIter++;
> > }
> > ::WaitForMultipleObjects (8,
> > phEightThreads,true,INFINITE);
> >
> > }
> >
> > Following is the thread proc that try to recieve
> interface
> > pointer from
> > global.
> > and at the point it calls API
> GetInterfaceFromGlobal the API hangs.
> >
> >
> > int CAppThread::ExcelThreadProcSendJob(LPVOID
> pParam)
> > {
> > ::CoInitialize (0);
> > //i++;
> >
> > // ::MessageBox
> (0,_bstr_t(long(i)),_bstr_t("Thread No:"),0);
> >
> > try
> > {
> > {
> >
> > IUnknown* pUnk = 0;
> > IRFT* pRFT = 0;
> > //IRFT* ptr = 0;
> > Transfer *pTransfer = (Transfer*)pParam;
> > //DWORD* pDW = (DWORD*)pParam;
> > //IStream* pStream = (IStream*)pParam;
> > //_ConnectionPtr spPtr;
> > MSXML2::IXMLDOMDocumentPtr spTest;
> > //(__uuidof(MSXML2::DOMDocument40));
> > //spTest.CreateInstance
> (__uuidof(MSXML2::DOMDocument40));
> > //HRESULT hr =
> >
>
m_pGlobal->GetInterfaceFromGlobal((pTransfer->Cookie),__uuidof
> > (IRFT),(void**
> > )&pRFT);
> > HRESULT hr =
> >
>
m_pGlobal->GetInterfaceFromGlobal(dw,__uuidof(MSXML2::IXMLDOMD
> > ocumentPtr),(v
> > oid**)&spTest);
> > //Unmarshall Application Pointer
> > //HRESULT hr =
> >
>
CoGetInterfaceAndReleaseStream((pStream),__uuidof(IUnknown),(LPVOID
> > *)&pUnk);
> > ::MessageBox
> (0,_bstr_t(long(0)),_bstr_t("Inside
> > SendJob Thread-Check"),0);
> >
> >
>
----------------------------------------------------------------
> > 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
__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.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
----------------------------------------------------------------
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 ]