Commit fa4036eb authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

Use interlocked functions for thread safety.

parent c0b772dc
...@@ -161,7 +161,7 @@ static IClassFactoryVtbl ITSSCF_Vtbl = ...@@ -161,7 +161,7 @@ static IClassFactoryVtbl ITSSCF_Vtbl =
HRESULT WINAPI ITSS_DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) HRESULT WINAPI ITSS_DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
{ {
int i; DWORD i;
IClassFactoryImpl *factory; IClassFactoryImpl *factory;
TRACE("%s %s %p\n",debugstr_guid(rclsid), debugstr_guid(iid), ppv); TRACE("%s %s %p\n",debugstr_guid(rclsid), debugstr_guid(iid), ppv);
...@@ -230,14 +230,14 @@ ULONG WINAPI ITStorageImpl_AddRef( ...@@ -230,14 +230,14 @@ ULONG WINAPI ITStorageImpl_AddRef(
{ {
ITStorageImpl *This = (ITStorageImpl *)iface; ITStorageImpl *This = (ITStorageImpl *)iface;
TRACE("%p\n", This); TRACE("%p\n", This);
return ++(This->ref); return InterlockedIncrement(&This->ref);
} }
ULONG WINAPI ITStorageImpl_Release( ULONG WINAPI ITStorageImpl_Release(
IITStorage* iface) IITStorage* iface)
{ {
ITStorageImpl *This = (ITStorageImpl *)iface; ITStorageImpl *This = (ITStorageImpl *)iface;
ULONG ref = --This->ref; ULONG ref = InterlockedDecrement(&This->ref);
if (ref == 0) if (ref == 0)
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment