2 * DirectPlay8 ThreadPool
4 * Copyright 2004 Raphael Junqueira
5 * Copyright 2008 Alexander N. Sørnes <alex@thehandofagony.com>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
33 #include "wine/debug.h"
36 #include "dpnet_private.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(dpnet
);
40 /* IUnknown interface follows */
42 static HRESULT WINAPI
IDirectPlay8ThreadPoolImpl_QueryInterface(PDIRECTPLAY8THREADPOOL iface
, REFIID riid
, LPVOID
*ppobj
)
44 IDirectPlay8ThreadPoolImpl
*This
= (IDirectPlay8ThreadPoolImpl
*)iface
;
46 if(IsEqualGUID(riid
, &IID_IUnknown
) ||
47 IsEqualGUID(riid
, &IID_IDirectPlay8ThreadPool
))
49 IUnknown_AddRef(iface
);
54 WARN("(%p)->(%s,%p): not found\n", This
, debugstr_guid(riid
), ppobj
);
58 static ULONG WINAPI
IDirectPlay8ThreadPoolImpl_AddRef(PDIRECTPLAY8THREADPOOL iface
)
60 IDirectPlay8ThreadPoolImpl
* This
= (IDirectPlay8ThreadPoolImpl
*)iface
;
61 ULONG RefCount
= InterlockedIncrement(&This
->ref
);
66 static ULONG WINAPI
IDirectPlay8ThreadPoolImpl_Release(PDIRECTPLAY8THREADPOOL iface
)
68 IDirectPlay8ThreadPoolImpl
* This
= (IDirectPlay8ThreadPoolImpl
*)This
;
69 ULONG RefCount
= InterlockedDecrement(&This
->ref
);
72 HeapFree(GetProcessHeap(), 0, This
);
77 /* IDirectPlay8ThreadPool interface follows */
78 static HRESULT WINAPI
IDirectPlay8ThreadPoolImpl_Initialize(PDIRECTPLAY8THREADPOOL iface
, PVOID CONST pvUserContext
, CONST PFNDPNMESSAGEHANDLER pfn
, CONST DWORD dwFlags
)
80 FIXME("(%p)->(%p,%p,%x): stub\n", iface
, pvUserContext
, pfn
, dwFlags
);
84 static HRESULT WINAPI
IDirectPlay8ThreadPoolImpl_Close(PDIRECTPLAY8THREADPOOL iface
, CONST DWORD dwFlags
)
89 static HRESULT WINAPI
IDirectPlay8ThreadPoolImpl_GetThreadCount(PDIRECTPLAY8THREADPOOL iface
, CONST DWORD dwProcessorNum
, DWORD
* CONST pdwNumThreads
, CONST DWORD dwFlags
)
91 FIXME("(%p)->(%x,%p,%x): stub\n", iface
, dwProcessorNum
, pdwNumThreads
, dwFlags
);
96 static HRESULT WINAPI
IDirectPlay8ThreadPoolImpl_SetThreadCount(PDIRECTPLAY8THREADPOOL iface
, CONST DWORD dwProcessorNum
, CONST DWORD dwNumThreads
, CONST DWORD dwFlags
)
98 FIXME("(%p)->(%x,%x,%x): stub\n", iface
, dwProcessorNum
, dwNumThreads
, dwFlags
);
102 static HRESULT WINAPI
IDirectPlay8ThreadPoolImpl_DoWork(PDIRECTPLAY8THREADPOOL iface
, CONST DWORD dwAllowedTimeSlice
, CONST DWORD dwFlags
)
104 static BOOL Run
= FALSE
;
107 FIXME("(%p)->(%x,%x): stub\n", iface
, dwAllowedTimeSlice
, dwFlags
);
114 static const IDirectPlay8ThreadPoolVtbl DirectPlay8ThreadPool_Vtbl
=
116 IDirectPlay8ThreadPoolImpl_QueryInterface
,
117 IDirectPlay8ThreadPoolImpl_AddRef
,
118 IDirectPlay8ThreadPoolImpl_Release
,
119 IDirectPlay8ThreadPoolImpl_Initialize
,
120 IDirectPlay8ThreadPoolImpl_Close
,
121 IDirectPlay8ThreadPoolImpl_GetThreadCount
,
122 IDirectPlay8ThreadPoolImpl_SetThreadCount
,
123 IDirectPlay8ThreadPoolImpl_DoWork
126 HRESULT
DPNET_CreateDirectPlay8ThreadPool(LPCLASSFACTORY iface
, LPUNKNOWN punkOuter
, REFIID riid
, LPVOID
*ppobj
)
128 IDirectPlay8ThreadPoolImpl
* Client
;
130 Client
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectPlay8ThreadPoolImpl
));
135 WARN("Not enough memory\n");
136 return E_OUTOFMEMORY
;
139 Client
->lpVtbl
= &DirectPlay8ThreadPool_Vtbl
;
142 return IDirectPlay8ThreadPoolImpl_QueryInterface((PDIRECTPLAY8THREADPOOL
)Client
, riid
, ppobj
);