]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
atomic_t: update spinlock implementation.
authorGreg Farnum <gregory.farnum@dreamhost.com>
Fri, 19 Aug 2011 16:15:42 +0000 (09:15 -0700)
committerGreg Farnum <gregory.farnum@dreamhost.com>
Fri, 19 Aug 2011 16:15:50 +0000 (09:15 -0700)
Somebody added a 'set' function without adding the non-atomic_ops
version!

Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
src/include/atomic.h

index 293b86a0c28d9d3c5eaa33cd47154315ed2c32a6..5d4a9a31277167a8d9e7eafca374ac00a73491e9 100644 (file)
@@ -76,6 +76,11 @@ namespace ceph {
     ~atomic_t() {
       pthread_spin_destroy(&lock);
     }
+    void set(size_t v) {
+      pthread_spin_lock(&lock);
+      int r = v;
+      pthread_spin_unlock(&lock);
+    }
     int inc() {
       pthread_spin_lock(&lock);
       int r = ++val;