[PATCH 1.1] Windows Interlock: Function wInterlocked set to return 0


John Gray <jgray@...>
 

Function wInterlocked set to return 0 for windows.  Not an operation (no-op) in Unix.

 

Index: queue.c

===================================================================

RCS file: /cvsroot/products/mama/c_cpp/src/c/queue.c,v

retrieving revision 1.35.4.5.2.1.4.11

diff -w -u -r1.35.4.5.2.1.4.11 queue.c

--- queue.c 27 Sep 2011 12:38:50 -0000  1.35.4.5.2.1.4.11

+++ queue.c 14 Jan 2012 09:41:43 -0000

@@ -198,6 +198,7 @@

     impl->mQueueMonitorClosure  =   NULL;

 

     /* Create the counter lock. */

+    wInterlocked_initialize(&impl->mNumberOpenObjects);

     wInterlocked_set(0, &impl->mNumberOpenObjects);

 

 

@@ -436,7 +437,7 @@

     int newCount = wInterlocked_decrement(&impl->mNumberOpenObjects);

 

     /* Write a log if something has gone wrong. */

-    if(impl->mNumberOpenObjects < 0)

+    if(newCount < 0)

     {

         mama_log(MAMA_LOG_LEVEL_ERROR, "Queue 0x%p has been dereferenced too many times.", queue);

     }

@@ -719,6 +720,9 @@

         impl->mMamaQueueBridgeImpl = NULL;

         impl->mMsg                 = NULL;

 

+        /* Destroy the counter lock */

+        wInterlocked_destroy(&impl->mNumberOpenObjects);

+

         free (impl);

 

         mama_log (MAMA_LOG_LEVEL_FINEST, "Leaving mamaQueue_destroy for queue 0x%X.", queue);

 

Signed-off-by: John Gray <jgray@...>

 

Join Openmama-dev@lists.openmama.org to automatically receive all group messages.