Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] r2010 - in trunk: Core/Thread tests


Chronological Thread 
  • From: boulos@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [Manta] r2010 - in trunk: Core/Thread tests
  • Date: Mon, 28 Jan 2008 12:37:40 -0700 (MST)

Author: boulos
Date: Mon Jan 28 12:37:39 2008
New Revision: 2010

Modified:
   trunk/Core/Thread/AtomicCounter_x86.cc
   trunk/tests/atomic_counter.cc
Log:
Core/Thread/AtomicCounter_x86.cc

 Set needed a volatile copy of the setting val (thanks compiler 
optimizations).

tests/atomic_counter.cc

 Updating the atomic_counter test to also test setting the value after
 the run.


Modified: trunk/Core/Thread/AtomicCounter_x86.cc
==============================================================================
--- trunk/Core/Thread/AtomicCounter_x86.cc      (original)
+++ trunk/Core/Thread/AtomicCounter_x86.cc      Mon Jan 28 12:37:39 2008
@@ -121,11 +121,12 @@
 
 void
 AtomicCounter::set(int v) {
+  volatile int copy_val = v;
   __asm__ __volatile__(
     "lock;\n"
     "xchgl %1, %0\n" :
-    "=m" (value), "=r" (v) :
-    "m" (value), "r" (v) :
+    "=m" (value), "=r" (copy_val) :
+    "m" (value), "r" (copy_val) :
     /* no unknown clobbers */
     );
 }

Modified: trunk/tests/atomic_counter.cc
==============================================================================
--- trunk/tests/atomic_counter.cc       (original)
+++ trunk/tests/atomic_counter.cc       Mon Jan 28 12:37:39 2008
@@ -85,6 +85,13 @@
   if (result != np * count) {
     return -1;
   }
+  const int kResetValue = 0;
+  counter_ref.set(kResetValue);
+  result = counter_ref;
+  printf("Reset to %d = %d\n", kResetValue, result);
+  if (result != kResetValue) {
+    return -1;
+  }
   return 0;
 }
 




  • [Manta] r2010 - in trunk: Core/Thread tests, boulos, 01/28/2008

Archive powered by MHonArc 2.6.16.

Top of page