ReactOS 0.4.17-dev-934-g091855f
threadpool.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "objbase.h"
#include "wine/debug.h"
#include "dpnet_private.h"
Include dependency graph for threadpool.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (dpnet)
 
static IDirectPlay8ThreadPoolImpl * impl_from_IDirectPlay8ThreadPool (IDirectPlay8ThreadPool *iface)
 
static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_QueryInterface (IDirectPlay8ThreadPool *iface, REFIID riid, void **ret_iface)
 
static ULONG WINAPI IDirectPlay8ThreadPoolImpl_AddRef (IDirectPlay8ThreadPool *iface)
 
static ULONG WINAPI IDirectPlay8ThreadPoolImpl_Release (IDirectPlay8ThreadPool *iface)
 
static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_Initialize (IDirectPlay8ThreadPool *iface, void *const pvUserContext, const PFNDPNMESSAGEHANDLER pfn, const DWORD dwFlags)
 
static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_Close (IDirectPlay8ThreadPool *iface, const DWORD dwFlags)
 
static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_GetThreadCount (IDirectPlay8ThreadPool *iface, const DWORD dwProcessorNum, DWORD *const pdwNumThreads, const DWORD dwFlags)
 
static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_SetThreadCount (IDirectPlay8ThreadPool *iface, const DWORD dwProcessorNum, const DWORD dwNumThreads, const DWORD dwFlags)
 
static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_DoWork (IDirectPlay8ThreadPool *iface, const DWORD dwAllowedTimeSlice, const DWORD dwFlags)
 
HRESULT DPNET_CreateDirectPlay8ThreadPool (LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj)
 

Variables

static PFNDPNMESSAGEHANDLER threadpool_msghandler = NULL
 
static DWORD threadpool_flags = 0
 
static void * threadpool_usercontext = NULL
 
static const IDirectPlay8ThreadPoolVtbl DirectPlay8ThreadPool_Vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 26 of file threadpool.c.

Function Documentation

◆ DPNET_CreateDirectPlay8ThreadPool()

HRESULT DPNET_CreateDirectPlay8ThreadPool ( LPCLASSFACTORY  iface,
LPUNKNOWN  punkOuter,
REFIID  riid,
LPVOID *  ppobj 
)

Definition at line 157 of file threadpool.c.

158{
160
162
163 if(Client == NULL)
164 {
165 *ppobj = NULL;
166 WARN("Not enough memory\n");
167 return E_OUTOFMEMORY;
168 }
169
170 Client->IDirectPlay8ThreadPool_iface.lpVtbl = &DirectPlay8ThreadPool_Vtbl;
171 Client->ref = 0;
172
173 return IDirectPlay8ThreadPoolImpl_QueryInterface(&Client->IDirectPlay8ThreadPool_iface, riid,
174 ppobj);
175}
#define WARN(fmt,...)
Definition: precomp.h:61
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define NULL
Definition: types.h:112
static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_QueryInterface(IDirectPlay8ThreadPool *iface, REFIID riid, void **ret_iface)
Definition: threadpool.c:48
static const IDirectPlay8ThreadPoolVtbl DirectPlay8ThreadPool_Vtbl
Definition: threadpool.c:145
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
REFIID riid
Definition: atlbase.h:39
Definition: client.c:31
LONG ref
Definition: client.c:37

◆ IDirectPlay8ThreadPoolImpl_AddRef()

static ULONG WINAPI IDirectPlay8ThreadPoolImpl_AddRef ( IDirectPlay8ThreadPool *  iface)
static

Definition at line 62 of file threadpool.c.

63{
65 ULONG RefCount = InterlockedIncrement(&This->ref);
66
67 return RefCount;
68}
#define InterlockedIncrement
Definition: armddk.h:53
static IDirectPlay8ThreadPoolImpl * impl_from_IDirectPlay8ThreadPool(IDirectPlay8ThreadPool *iface)
Definition: threadpool.c:42
uint32_t ULONG
Definition: typedefs.h:59

◆ IDirectPlay8ThreadPoolImpl_Close()

static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_Close ( IDirectPlay8ThreadPool *  iface,
const DWORD  dwFlags 
)
static

Definition at line 102 of file threadpool.c.

104{
106
107 FIXME("(%p)->(%lx)\n", This, dwFlags);
108
111
113
114 return DPN_OK;
115}
#define FIXME(fmt,...)
Definition: precomp.h:53
static PFNDPNMESSAGEHANDLER threadpool_msghandler
Definition: threadpool.c:38
#define DPN_OK
Definition: dplay8.h:75
#define DPNERR_UNINITIALIZED
Definition: dplay8.h:146
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141

◆ IDirectPlay8ThreadPoolImpl_DoWork()

static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_DoWork ( IDirectPlay8ThreadPool *  iface,
const DWORD  dwAllowedTimeSlice,
const DWORD  dwFlags 
)
static

Definition at line 132 of file threadpool.c.

134{
135 static BOOL Run = FALSE;
136
137 if(!Run)
138 FIXME("(%p)->(%lx,%lx): stub\n", iface, dwAllowedTimeSlice, dwFlags);
139
140 Run = TRUE;
141
142 return DPN_OK;
143}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: bidi.c:435

◆ IDirectPlay8ThreadPoolImpl_GetThreadCount()

static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_GetThreadCount ( IDirectPlay8ThreadPool *  iface,
const DWORD  dwProcessorNum,
DWORD *const  pdwNumThreads,
const DWORD  dwFlags 
)
static

Definition at line 117 of file threadpool.c.

119{
120 FIXME("(%p)->(%lx,%p,%lx): stub\n", iface, dwProcessorNum, pdwNumThreads, dwFlags);
121 *pdwNumThreads = 0;
122 return DPN_OK;
123}

◆ IDirectPlay8ThreadPoolImpl_Initialize()

static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_Initialize ( IDirectPlay8ThreadPool *  iface,
void *const  pvUserContext,
const PFNDPNMESSAGEHANDLER  pfn,
const DWORD  dwFlags 
)
static

Definition at line 82 of file threadpool.c.

84{
86
87 TRACE("(%p)->(%p,%p,%lx)\n", This, pvUserContext, pfn, dwFlags);
88
89 if(!pfn)
91
94
97 threadpool_usercontext = pvUserContext;
98
99 return DPN_OK;
100}
static DWORD threadpool_flags
Definition: threadpool.c:39
static void * threadpool_usercontext
Definition: threadpool.c:40
#define DPNERR_ALREADYINITIALIZED
Definition: dplay8.h:88
#define DPNERR_INVALIDPARAM
Definition: dplay8.h:77
#define TRACE(s)
Definition: solgame.cpp:4

◆ IDirectPlay8ThreadPoolImpl_QueryInterface()

static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_QueryInterface ( IDirectPlay8ThreadPool *  iface,
REFIID  riid,
void **  ret_iface 
)
static

Definition at line 48 of file threadpool.c.

50{
51 if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectPlay8ThreadPool))
52 {
54 *ret_iface = iface;
55 return S_OK;
56 }
57
58 WARN("(%p)->(%s,%p): not found\n", iface, debugstr_guid(riid), ret_iface);
59 return E_NOINTERFACE;
60}
const GUID IID_IUnknown
#define IDirectPlay8ThreadPool_AddRef(p)
Definition: dplay8.h:929
#define S_OK
Definition: intsafe.h:52
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:3479

Referenced by DPNET_CreateDirectPlay8ThreadPool().

◆ IDirectPlay8ThreadPoolImpl_Release()

static ULONG WINAPI IDirectPlay8ThreadPoolImpl_Release ( IDirectPlay8ThreadPool *  iface)
static

Definition at line 70 of file threadpool.c.

71{
73 ULONG RefCount = InterlockedDecrement(&This->ref);
74
75 if(!RefCount)
77
78 return RefCount;
79}
#define InterlockedDecrement
Definition: armddk.h:52
#define HeapFree(x, y, z)
Definition: compat.h:735

◆ IDirectPlay8ThreadPoolImpl_SetThreadCount()

static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_SetThreadCount ( IDirectPlay8ThreadPool *  iface,
const DWORD  dwProcessorNum,
const DWORD  dwNumThreads,
const DWORD  dwFlags 
)
static

Definition at line 125 of file threadpool.c.

127{
128 FIXME("(%p)->(%lx,%lx,%lx): stub\n", iface, dwProcessorNum, dwNumThreads, dwFlags);
129 return DPN_OK;
130}

◆ impl_from_IDirectPlay8ThreadPool()

static IDirectPlay8ThreadPoolImpl * impl_from_IDirectPlay8ThreadPool ( IDirectPlay8ThreadPool *  iface)
inlinestatic

Definition at line 42 of file threadpool.c.

43{
44 return CONTAINING_RECORD(iface, IDirectPlay8ThreadPoolImpl, IDirectPlay8ThreadPool_iface);
45}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by IDirectPlay8ThreadPoolImpl_AddRef(), IDirectPlay8ThreadPoolImpl_Close(), IDirectPlay8ThreadPoolImpl_Initialize(), and IDirectPlay8ThreadPoolImpl_Release().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( dpnet  )

Variable Documentation

◆ DirectPlay8ThreadPool_Vtbl

const IDirectPlay8ThreadPoolVtbl DirectPlay8ThreadPool_Vtbl
static
Initial value:
=
{
}
static ULONG WINAPI IDirectPlay8ThreadPoolImpl_Release(IDirectPlay8ThreadPool *iface)
Definition: threadpool.c:70
static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_GetThreadCount(IDirectPlay8ThreadPool *iface, const DWORD dwProcessorNum, DWORD *const pdwNumThreads, const DWORD dwFlags)
Definition: threadpool.c:117
static ULONG WINAPI IDirectPlay8ThreadPoolImpl_AddRef(IDirectPlay8ThreadPool *iface)
Definition: threadpool.c:62
static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_Initialize(IDirectPlay8ThreadPool *iface, void *const pvUserContext, const PFNDPNMESSAGEHANDLER pfn, const DWORD dwFlags)
Definition: threadpool.c:82
static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_Close(IDirectPlay8ThreadPool *iface, const DWORD dwFlags)
Definition: threadpool.c:102
static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_DoWork(IDirectPlay8ThreadPool *iface, const DWORD dwAllowedTimeSlice, const DWORD dwFlags)
Definition: threadpool.c:132
static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_SetThreadCount(IDirectPlay8ThreadPool *iface, const DWORD dwProcessorNum, const DWORD dwNumThreads, const DWORD dwFlags)
Definition: threadpool.c:125

Definition at line 145 of file threadpool.c.

Referenced by DPNET_CreateDirectPlay8ThreadPool().

◆ threadpool_flags

DWORD threadpool_flags = 0
static

Definition at line 39 of file threadpool.c.

Referenced by IDirectPlay8ThreadPoolImpl_Initialize().

◆ threadpool_msghandler

PFNDPNMESSAGEHANDLER threadpool_msghandler = NULL
static

◆ threadpool_usercontext

void* threadpool_usercontext = NULL
static

Definition at line 40 of file threadpool.c.

Referenced by IDirectPlay8ThreadPoolImpl_Initialize().