|
-
May 10th, 1999, 07:51 PM
#3
Re: Multithreading in DCOM - Urgent!! Urgent!!
hi,
The call to unmarshall will fail for the second thread because u are using a single stream for storing the marshalled pointer and passing the same stream to both the threads.try this one...
MyProject()
{
// Create the thread two times
for(int i=0; i<2; i++)
{
HRESULT hRes = CoMarshalInterThreadInterfaceInStream(IID_IServer, m_pServer, (LPSTREAM *) & m_pStream);
CreateThread(NULL, 0, StartPlayWrapper,m_pStream, 0, &dwThreadID);
}
}
DWORD StartPlayWrapper(LPVOID lpVoid)
{
HRESULT hRes = CoInitialize(NULL);
IServer *pServer = NULL;
hRes = CoUnMarshalInterface((IStream*)lpVoid, IID_IServer, (void **)&pServer);
// Till here no problem comes, but calling the StartPlay() method is not envoking.
// No Error message comes
pServer->StartPlay(); // Ignore this statament while debugging.
}
-RajM([email protected])
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|