Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Diff of /pthread_mutex_lock.c [26ed1e] .. [3f334b] Maximize Restore

  Switch to side-by-side view

--- a/pthread_mutex_lock.c
+++ b/pthread_mutex_lock.c
@@ -77,13 +77,13 @@
       /* Non-robust */
       if (PTHREAD_MUTEX_NORMAL == kind)
         {
-          if ((LONG) PTW32_INTERLOCKED_EXCHANGE(
-		       (LPLONG) &mx->lock_idx,
-		       (LONG) 1) != 0)
+          if ((PTW32_INTERLOCKED_VALUE) PTW32_INTERLOCKED_EXCHANGE(
+		       (PTW32_INTERLOCKED_PTR) &mx->lock_idx,
+		       (PTW32_INTERLOCKED_VALUE) 1) != 0)
 	    {
-	      while ((LONG) PTW32_INTERLOCKED_EXCHANGE(
-                              (LPLONG) &mx->lock_idx,
-			      (LONG) -1) != 0)
+	      while ((PTW32_INTERLOCKED_VALUE) PTW32_INTERLOCKED_EXCHANGE(
+                              (PTW32_INTERLOCKED_PTR) &mx->lock_idx,
+			      (PTW32_INTERLOCKED_VALUE) -1) != 0)
 	        {
 	          if (WAIT_OBJECT_0 != WaitForSingleObject (mx->event, INFINITE))
 	            {
@@ -97,10 +97,10 @@
         {
           pthread_t self = pthread_self();
 
-          if ((PTW32_INTERLOCKED_LONG) PTW32_INTERLOCKED_COMPARE_EXCHANGE(
-                       (PTW32_INTERLOCKED_LPLONG) &mx->lock_idx,
-		       (PTW32_INTERLOCKED_LONG) 1,
-		       (PTW32_INTERLOCKED_LONG) 0) == 0)
+          if ((PTW32_INTERLOCKED_VALUE) PTW32_INTERLOCKED_COMPARE_EXCHANGE(
+                       (PTW32_INTERLOCKED_PTR) &mx->lock_idx,
+		       (PTW32_INTERLOCKED_VALUE) 1,
+		       (PTW32_INTERLOCKED_VALUE) 0) == 0)
 	    {
 	      mx->recursive_count = 1;
 	      mx->ownerThread = self;
@@ -120,9 +120,9 @@
 	        }
 	      else
 	        {
-	          while ((LONG) PTW32_INTERLOCKED_EXCHANGE(
-                                  (LPLONG) &mx->lock_idx,
-			          (LONG) -1) != 0)
+	          while ((PTW32_INTERLOCKED_VALUE) PTW32_INTERLOCKED_EXCHANGE(
+                                  (PTW32_INTERLOCKED_PTR) &mx->lock_idx,
+			          (PTW32_INTERLOCKED_VALUE) -1) != 0)
 		    {
 	              if (WAIT_OBJECT_0 != WaitForSingleObject (mx->event, INFINITE))
 		        {
@@ -149,9 +149,9 @@
        */
       ptw32_robust_state_t* statePtr = &mx->robustNode->stateInconsistent;
 
-      if ((LONG)PTW32_ROBUST_NOTRECOVERABLE == PTW32_INTERLOCKED_EXCHANGE_ADD(
-                                                 (LPLONG)statePtr,
-                                                 0L))
+      if ((PTW32_INTERLOCKED_VALUE)PTW32_ROBUST_NOTRECOVERABLE == PTW32_INTERLOCKED_EXCHANGE_ADD(
+                                                 (PTW32_INTERLOCKED_PTR)statePtr,
+                                                 (PTW32_INTERLOCKED_VALUE)0))
         {
           result = ENOTRECOVERABLE;
         }
@@ -163,24 +163,24 @@
     
           if (PTHREAD_MUTEX_NORMAL == kind)
             {
-              if ((LONG) PTW32_INTERLOCKED_EXCHANGE(
-                           (LPLONG) &mx->lock_idx,
-                           (LONG) 1) != 0)
+              if ((PTW32_INTERLOCKED_VALUE) PTW32_INTERLOCKED_EXCHANGE(
+                           (PTW32_INTERLOCKED_PTR) &mx->lock_idx,
+                           (PTW32_INTERLOCKED_VALUE) 1) != 0)
                 {
                   while (0 == (result = ptw32_robust_mutex_inherit(mutex))
-                           && (LONG) PTW32_INTERLOCKED_EXCHANGE(
-                                       (LPLONG) &mx->lock_idx,
-                                       (LONG) -1) != 0)
+                           && (PTW32_INTERLOCKED_VALUE) PTW32_INTERLOCKED_EXCHANGE(
+                                       (PTW32_INTERLOCKED_PTR) &mx->lock_idx,
+                                       (PTW32_INTERLOCKED_VALUE) -1) != 0)
                     {
                       if (WAIT_OBJECT_0 != WaitForSingleObject (mx->event, INFINITE))
                         {
                           result = EINVAL;
                           break;
                         }
-                      if ((LONG)PTW32_ROBUST_NOTRECOVERABLE ==
+                      if ((PTW32_INTERLOCKED_VALUE)PTW32_ROBUST_NOTRECOVERABLE ==
                                   PTW32_INTERLOCKED_EXCHANGE_ADD(
-                                    (LPLONG)statePtr,
-                                    0L))
+                                    (PTW32_INTERLOCKED_PTR)statePtr,
+                                    (PTW32_INTERLOCKED_VALUE)0))
                         {
                           /* Unblock the next thread */
                           SetEvent(mx->event);
@@ -200,10 +200,10 @@
             }
           else
             {
-              if ((PTW32_INTERLOCKED_LONG) PTW32_INTERLOCKED_COMPARE_EXCHANGE(
-                           (PTW32_INTERLOCKED_LPLONG) &mx->lock_idx,
-                           (PTW32_INTERLOCKED_LONG) 1,
-                           (PTW32_INTERLOCKED_LONG) 0) == 0)
+              if ((PTW32_INTERLOCKED_VALUE) PTW32_INTERLOCKED_COMPARE_EXCHANGE(
+                           (PTW32_INTERLOCKED_PTR) &mx->lock_idx,
+                           (PTW32_INTERLOCKED_VALUE) 1,
+                           (PTW32_INTERLOCKED_VALUE) 0) == 0)
                 {
                   mx->recursive_count = 1;
                   /*
@@ -228,19 +228,19 @@
                   else
                     {
                       while (0 == (result = ptw32_robust_mutex_inherit(mutex))
-                               && (LONG) PTW32_INTERLOCKED_EXCHANGE(
-                                           (LPLONG) &mx->lock_idx,
-                                           (LONG) -1) != 0)
+                               && (PTW32_INTERLOCKED_VALUE) PTW32_INTERLOCKED_EXCHANGE(
+                                           (PTW32_INTERLOCKED_PTR) &mx->lock_idx,
+                                           (PTW32_INTERLOCKED_VALUE) -1) != 0)
                         {
                           if (WAIT_OBJECT_0 != WaitForSingleObject (mx->event, INFINITE))
                             {
                               result = EINVAL;
                               break;
                             }
-                          if ((LONG)PTW32_ROBUST_NOTRECOVERABLE ==
+                          if ((PTW32_INTERLOCKED_VALUE)PTW32_ROBUST_NOTRECOVERABLE ==
                                       PTW32_INTERLOCKED_EXCHANGE_ADD(
-                                        (LPLONG)statePtr,
-                                        0L))
+                                        (PTW32_INTERLOCKED_PTR)statePtr,
+                                        (PTW32_INTERLOCKED_VALUE)0))
                             {
                               /* Unblock the next thread */
                               SetEvent(mx->event);