]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
simple_spin: use file-scope global not function
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Sat, 4 Jun 2011 01:15:11 +0000 (18:15 -0700)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Sat, 4 Jun 2011 01:15:11 +0000 (18:15 -0700)
function-scoped globals are protected by a mutex, and taking a mutex
inside a spin lock implementation kind of defeats the point...

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
src/common/simple_spin.cc

index 188481bc5ebd86adc27a55a8e405e7f1293eb28d..fc4ac633deaf113316744f7e3f6208a45795b5c7 100644 (file)
 #include <stdint.h>
 #include <pthread.h>
 
+static uint32_t bar = 13;
+static uint32_t *foo = &bar;
 void simple_spin_lock(simple_spinlock_t *lock)
 {
-  static uint32_t bar = 13;
-  static uint32_t *foo = &bar;
   while(1) {
     __sync_synchronize();
     uint32_t oldval = *lock;