Module: wine Branch: master Commit: 072c58e322fddba772bd87bc79dcf9f7938a1c57 URL: http://source.winehq.org/git/wine.git/?a=commit;h=072c58e322fddba772bd87bc79...
Author: Alistair Leslie-Hughes leslie_alistair@hotmail.com Date: Thu Mar 23 01:57:05 2017 +0000
dpnet: Share message handler between IDirectPlay8ThreadPool objects.
Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/dpnet/dpnet_private.h | 4 ---- dlls/dpnet/tests/thread.c | 8 ++++---- dlls/dpnet/threadpool.c | 17 ++++++++++++----- 3 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/dlls/dpnet/dpnet_private.h b/dlls/dpnet/dpnet_private.h index 7b6de4a..44ff289d 100644 --- a/dlls/dpnet/dpnet_private.h +++ b/dlls/dpnet/dpnet_private.h @@ -122,10 +122,6 @@ struct IDirectPlay8ThreadPoolImpl { IDirectPlay8ThreadPool IDirectPlay8ThreadPool_iface; LONG ref; - - PFNDPNMESSAGEHANDLER msghandler; - DWORD flags; - void *usercontext; };
/** diff --git a/dlls/dpnet/tests/thread.c b/dlls/dpnet/tests/thread.c index 99de2be..78515f8 100644 --- a/dlls/dpnet/tests/thread.c +++ b/dlls/dpnet/tests/thread.c @@ -70,7 +70,7 @@ static void create_threadpool(void) ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IDirectPlay8ThreadPool_Initialize(pool2, NULL, &DirectPlayThreadHandler, 0); - todo_wine ok(hr == DPNERR_ALREADYINITIALIZED, "got 0x%08x\n", hr); + ok(hr == DPNERR_ALREADYINITIALIZED, "got 0x%08x\n", hr);
hr = IDirectPlay8ThreadPool_GetThreadCount(pool1, -1, &threadcnt, 0); ok(hr == S_OK, "got 0x%08x\n", hr); @@ -103,7 +103,7 @@ static void create_threadpool(void) ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IDirectPlay8ThreadPool_Close(pool2, 0); - todo_wine ok(hr == DPNERR_UNINITIALIZED, "got 0x%08x\n", hr); + ok(hr == DPNERR_UNINITIALIZED, "got 0x%08x\n", hr);
IDirectPlay8ThreadPool_Release(pool1); IDirectPlay8ThreadPool_Release(pool2); @@ -226,13 +226,13 @@ static void test_singleton(void) ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IDirectPlay8ThreadPool_Initialize(pool2, NULL, &DirectPlayThreadHandler, 0); - todo_wine ok(hr == DPNERR_ALREADYINITIALIZED, "got 0x%08x\n", hr); + ok(hr == DPNERR_ALREADYINITIALIZED, "got 0x%08x\n", hr);
hr = IDirectPlay8ThreadPool_Close(pool1, 0); ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IDirectPlay8ThreadPool_Close(pool2, 0); - todo_wine ok(hr == DPNERR_UNINITIALIZED, "got 0x%08x\n", hr); + ok(hr == DPNERR_UNINITIALIZED, "got 0x%08x\n", hr);
IDirectPlay8ThreadPool_Release(pool1); IDirectPlay8ThreadPool_Release(pool2); diff --git a/dlls/dpnet/threadpool.c b/dlls/dpnet/threadpool.c index 37a05e2..7e84a5a 100644 --- a/dlls/dpnet/threadpool.c +++ b/dlls/dpnet/threadpool.c @@ -36,6 +36,10 @@
WINE_DEFAULT_DEBUG_CHANNEL(dpnet);
+static PFNDPNMESSAGEHANDLER threadpool_msghandler = NULL; +static DWORD threadpool_flags = 0; +static void *threadpool_usercontext = NULL; + static inline IDirectPlay8ThreadPoolImpl *impl_from_IDirectPlay8ThreadPool(IDirectPlay8ThreadPool *iface) { return CONTAINING_RECORD(iface, IDirectPlay8ThreadPoolImpl, IDirectPlay8ThreadPool_iface); @@ -89,12 +93,12 @@ static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_Initialize(IDirectPlay8ThreadPo if(!pfn) return DPNERR_INVALIDPARAM;
- if(This->msghandler) + if(threadpool_msghandler) return DPNERR_ALREADYINITIALIZED;
- This->msghandler = pfn; - This->flags = dwFlags; - This->usercontext = pvUserContext; + threadpool_msghandler = pfn; + threadpool_flags = dwFlags; + threadpool_usercontext = pvUserContext;
return DPN_OK; } @@ -106,7 +110,10 @@ static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_Close(IDirectPlay8ThreadPool *i
FIXME("(%p)->(%x)\n", This, dwFlags);
- This->msghandler = NULL; + if(!threadpool_msghandler) + return DPNERR_UNINITIALIZED; + + threadpool_msghandler = NULL;
return DPN_OK; }