From: Colin Patrick McCabe Date: Sat, 4 Jun 2011 01:15:11 +0000 (-0700) Subject: simple_spin: use file-scope global not function X-Git-Tag: v0.30~123 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4abdf6fda4585235e653d86ba823815b44c92b34;p=ceph.git simple_spin: use file-scope global not function 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 --- diff --git a/src/common/simple_spin.cc b/src/common/simple_spin.cc index 188481bc5ebd..fc4ac633deaf 100644 --- a/src/common/simple_spin.cc +++ b/src/common/simple_spin.cc @@ -18,11 +18,11 @@ #include #include +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;