Force context switch on chanbuf disconnect to avoid a race in the test

suite.
This commit is contained in:
Mike Hearn 2005-01-14 15:11:24 +00:00 committed by Alexandre Julliard
parent 7b3d092c26
commit ba0475e738
1 changed files with 10 additions and 0 deletions

View File

@ -302,6 +302,7 @@ PipeBuf_Release(LPRPCCHANNELBUFFER iface) {
wine_rpc_disconnect_header header; wine_rpc_disconnect_header header;
HANDLE pipe; HANDLE pipe;
DWORD reqtype = REQTYPE_DISCONNECT; DWORD reqtype = REQTYPE_DISCONNECT;
DWORD magic;
ref = InterlockedDecrement(&This->ref); ref = InterlockedDecrement(&This->ref);
if (ref) if (ref)
@ -316,6 +317,12 @@ PipeBuf_Release(LPRPCCHANNELBUFFER iface) {
TRACE("written disconnect packet\n"); TRACE("written disconnect packet\n");
/* prevent a disconnect race with the other side: this isn't
* necessary for real dcom but the test suite needs it */
read_pipe(pipe, &magic, sizeof(magic));
if (magic != 0xcafebabe) ERR("bad disconnection magic: expecting 0xcafebabe but got 0x%lx", magic);
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(),0,This);
return 0; return 0;
} }
@ -776,6 +783,7 @@ COM_RpcReceive(wine_pipe *xpipe) {
if (reqtype == REQTYPE_DISCONNECT) { /* only received by servers */ if (reqtype == REQTYPE_DISCONNECT) { /* only received by servers */
wine_rpc_disconnect_header header; wine_rpc_disconnect_header header;
struct stub_manager *stubmgr; struct stub_manager *stubmgr;
DWORD magic = 0xcafebabe;
hres = read_pipe(xhPipe, &header, sizeof(header)); hres = read_pipe(xhPipe, &header, sizeof(header));
if (hres) { if (hres) {
@ -795,6 +803,8 @@ COM_RpcReceive(wine_pipe *xpipe) {
stub_manager_int_release(stubmgr); stub_manager_int_release(stubmgr);
write_pipe(xhPipe, &magic, sizeof(magic));
goto end; goto end;
} else if (reqtype == REQTYPE_REQUEST) { } else if (reqtype == REQTYPE_REQUEST) {
wine_rpc_request *xreq; wine_rpc_request *xreq;