commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r819595 - /commons/sandbox/runtime/trunk/src/main/native/test/testcase.c
Date Mon, 28 Sep 2009 15:41:44 GMT
Author: mturk
Date: Mon Sep 28 15:41:43 2009
New Revision: 819595

URL: http://svn.apache.org/viewvc?rev=819595&view=rev
Log:
Use Solaris atomics

Modified:
    commons/sandbox/runtime/trunk/src/main/native/test/testcase.c

Modified: commons/sandbox/runtime/trunk/src/main/native/test/testcase.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/test/testcase.c?rev=819595&r1=819594&r2=819595&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/test/testcase.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/test/testcase.c Mon Sep 28 15:41:43 2009
@@ -688,8 +688,12 @@
     return r;
 }
 
-static volatile int  dtf_counter = 0;
-static volatile int *dtf_called  = &dtf_counter;
+#if defined(SOLARIS2)
+#include <atomic.h>
+#endif
+
+static volatile unsigned int  dtf_counter = 0;
+static volatile unsigned int *dtf_called  = &dtf_counter;
 static int dtf_cleanup(void *d, int type, unsigned int flags)
 {
     x_free(d);
@@ -699,6 +703,8 @@
     __sync_fetch_and_add(dtf_called, 1);
 #elif defined(_MSC_VER)
     InterlockedIncrement(dtf_called);
+#elif defined(SOLARIS2)
+    atomic_inc_32(dtf_called);
 #else
     *dtf_called += 1;
 #endif



Mime
View raw message