Rename the STUBMGR thread to more accurately reflect its purpose.

This commit is contained in:
Mike Hearn 2004-12-07 17:01:40 +00:00 committed by Alexandre Julliard
parent 23ded07e63
commit 36aee71988
4 changed files with 18 additions and 13 deletions

View File

@ -1263,8 +1263,8 @@ HRESULT WINAPI CoRegisterClassObject(
if (dwClsContext & CLSCTX_LOCAL_SERVER) {
DWORD tid;
STUBMGR_Start();
newClass->hThread=CreateThread(NULL,0,_LocalServerThread,newClass,0,&tid);
start_listener_thread();
newClass->hThread = CreateThread(NULL,0,_LocalServerThread,newClass,0,&tid);
}
return S_OK;
}

View File

@ -152,7 +152,7 @@ HRESULT MARSHAL_Disconnect_Proxies();
HRESULT MARSHAL_GetStandardMarshalCF(LPVOID *ppv);
void STUBMGR_Start();
void start_listener_thread();
extern HRESULT PIPE_GetNewPipeBuf(wine_marshal_id *mid, IRpcChannelBuffer **pipebuf);

View File

@ -502,7 +502,8 @@ CoMarshalInterface( IStream *pStm, REFIID riid, IUnknown *pUnk,
if (pUnk == NULL)
return E_INVALIDARG;
STUBMGR_Start(); /* Just to be sure we have one running. */
start_listener_thread(); /* Just to be sure we have one running. */
mid.processid = GetCurrentProcessId();
IUnknown_QueryInterface(pUnk,&IID_IUnknown,(LPVOID*)&pUnknown);
mid.objectid = (DWORD)pUnknown;

View File

@ -759,13 +759,16 @@ _StubReaderThread(LPVOID param) {
return 0;
}
static DWORD WINAPI
_StubMgrThread(LPVOID param) {
/* This thread listens on a named pipe for the entire process. It
* deals with incoming connection requests to objects.
*/
static DWORD WINAPI listener_thread(LPVOID param)
{
char pipefn[200];
HANDLE listenPipe;
sprintf(pipefn,OLESTUBMGR"_%08lx",GetCurrentProcessId());
TRACE("Stub Manager Thread starting on (%s)\n",pipefn);
TRACE("Process listener thread starting on (%s)\n",pipefn);
while (1) {
listenPipe = CreateNamedPipeA(
@ -792,14 +795,15 @@ _StubMgrThread(LPVOID param) {
return 0;
}
void
STUBMGR_Start() {
static BOOL stubMgrRunning = FALSE;
void start_listener_thread()
{
static BOOL running = FALSE;
DWORD tid;
if (!stubMgrRunning) {
stubMgrRunning = TRUE;
CreateThread(NULL,0,_StubMgrThread,NULL,0,&tid);
if (!running)
{
running = TRUE;
CreateThread(NULL, 0, listener_thread, NULL, 0, &tid);
Sleep(2000); /* actually we just try opening the pipe until it succeeds */
}
}