[AMSTREAM] Use Interlocked* functions in AddRef and Release

Paul Vriens Paul.Vriens at xs4all.nl
Sun Jan 9 13:52:34 CST 2005


Hi,

Another small one.

Changelog:
- use Interlocked* functions in AddRef and Release.
- store the result of the Interlocked functions and use only this.

Cheers,

Paul Vriens

Index: dlls/amstream/amstream.c
===================================================================
RCS file: /home/wine/wine/dlls/amstream/amstream.c,v
retrieving revision 1.6
diff -u -r1.6 amstream.c
--- dlls/amstream/amstream.c    18 Oct 2004 21:21:19 -0000      1.6
+++ dlls/amstream/amstream.c    9 Jan 2005 19:47:49 -0000
@@ -85,17 +85,18 @@
                                                                                                                             
   FIXME("(%p/%p)\n", iface, This);
                                                                                                                             
-  This->ref++;
+  InterlockedIncrement(&This->ref);
   return S_OK;
 }
                                                                                                                             
 static ULONG WINAPI
IAMMultiMediaStreamImpl_Release(IAMMultiMediaStream* iface)
 {
   IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
+  ULONG ref = InterlockedDecrement(&This->ref);
                                                                                                                             
   FIXME("(%p/%p)\n", iface, This);
                                                                                                                             
-  if (!--This->ref)
+  if (!ref)
     HeapFree(GetProcessHeap(), 0, This);
                                                                                                                             
   return S_OK;




More information about the wine-patches mailing list