OSEC

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.singhKLA-TENCOR.COM)
Date: Thu Mar 07 2002 - 04:34:31 CST

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    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::IXMLDOMDocumentPtr),(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-requestDISCUSS.MICROSOFT.COM