ITSS: use interlocked functions for thread safety

Mike McCormack mike at codeweavers.com
Sun Nov 14 09:24:19 CST 2004


ChangeLog:
* use interlocked functions for thread safety
-------------- next part --------------
Index: dlls/itss/itss.c
===================================================================
RCS file: /home/wine/wine/dlls/itss/itss.c,v
retrieving revision 1.6
diff -u -r1.6 itss.c
--- dlls/itss/itss.c	18 Oct 2004 21:21:19 -0000	1.6
+++ dlls/itss/itss.c	14 Nov 2004 15:07:39 -0000
@@ -161,7 +161,7 @@
 
 HRESULT WINAPI ITSS_DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
 {
-    int i;
+    DWORD i;
     IClassFactoryImpl *factory;
 
     TRACE("%s %s %p\n",debugstr_guid(rclsid), debugstr_guid(iid), ppv);
@@ -230,14 +230,14 @@
 {
     ITStorageImpl *This = (ITStorageImpl *)iface;
     TRACE("%p\n", This);
-    return ++(This->ref);
+    return InterlockedIncrement(&This->ref);
 }
 
 ULONG WINAPI ITStorageImpl_Release(
     IITStorage* iface)
 {
     ITStorageImpl *This = (ITStorageImpl *)iface;
-    ULONG ref = --This->ref;
+    ULONG ref = InterlockedDecrement(&This->ref);
 
     if (ref == 0)
 	HeapFree(GetProcessHeap(), 0, This);


More information about the wine-patches mailing list