Use Interlocked* functions in AddRef and Release.

This commit is contained in:
Paul Vriens 2005-01-11 15:46:43 +00:00 committed by Alexandre Julliard
parent d2512860ac
commit 6a8268f372
2 changed files with 4 additions and 4 deletions

View File

@ -55,13 +55,13 @@ DP_and_DPL_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
static ULONG WINAPI static ULONG WINAPI
DP_and_DPL_AddRef(LPCLASSFACTORY iface) { DP_and_DPL_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface; IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
return ++(This->ref); return InterlockedIncrement(&This->ref);
} }
static ULONG WINAPI DP_and_DPL_Release(LPCLASSFACTORY iface) { static ULONG WINAPI DP_and_DPL_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface; IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class (reference starts @ 1), won't ever be freed */ /* static class (reference starts @ 1), won't ever be freed */
return --(This->ref); return InterlockedDecrement(&This->ref);
} }
static HRESULT WINAPI DP_and_DPL_CreateInstance( static HRESULT WINAPI DP_and_DPL_CreateInstance(

View File

@ -1516,13 +1516,13 @@ static HRESULT WINAPI MsiCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVO
static ULONG WINAPI MsiCF_AddRef(LPCLASSFACTORY iface) { static ULONG WINAPI MsiCF_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface; IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
return ++(This->ref); return InterlockedIncrement(&This->ref);
} }
static ULONG WINAPI MsiCF_Release(LPCLASSFACTORY iface) { static ULONG WINAPI MsiCF_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface; IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class, won't be freed */ /* static class, won't be freed */
return --(This->ref); return InterlockedDecrement(&This->ref);
} }
static HRESULT WINAPI MsiCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { static HRESULT WINAPI MsiCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {