From 64ff82ecf98ceb4725f0f51c73e23d1efc2160bc Mon Sep 17 00:00:00 2001 From: Michael Bebenita Date: Tue, 24 Aug 2010 21:06:56 -0700 Subject: Implemented an lock free queue based on this paper http://www.cs.rochester.edu/~scott/papers/1996_PODC_queues.pdf, the "lock free queue" we had before wasn't lock free at all. --- src/rt/sync/sync.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/rt/sync/sync.h') diff --git a/src/rt/sync/sync.h b/src/rt/sync/sync.h index 902b5661..8c9a13f0 100644 --- a/src/rt/sync/sync.h +++ b/src/rt/sync/sync.h @@ -4,6 +4,11 @@ class sync { public: static void yield(); + template + static bool compare_and_swap(T *address, + T oldValue, T newValue) { + return __sync_bool_compare_and_swap(address, oldValue, newValue); + } }; #endif /* SYNC_H */ -- cgit v1.2.3