From: Caren Thomas Date: Fri, 17 Jun 2016 18:24:54 +0000 (-0700) Subject: Add very basic compatibility with folly locks for synchronized X-Git-Tag: 2016.07.26~133 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=3c4a013ff85c5ff329c7270094f31881629b3581;p=folly.git Add very basic compatibility with folly locks for synchronized Summary: Add folly locks to the HasLockUnlock struct so that they can be used inside Synchronized. acquireReadWrite() and releaseReadWrite() functions are added to each lock class so that their .lock and .unlock methods are accessible by Synchronized. These changes allow an extremely basic level of compatibility for the purpose of running benchmarks and so compatibility with dual_locking, etc. have not been tested. Reviewed By: simpkins Differential Revision: D3434621 fbshipit-source-id: d55cffbb1eccaf23645384b9a41f85c5df593ffe --- diff --git a/folly/SpinLock.h b/folly/SpinLock.h index 6d10df4a..5ab44605 100644 --- a/folly/SpinLock.h +++ b/folly/SpinLock.h @@ -32,6 +32,8 @@ #pragma once +#include + #include namespace folly { @@ -62,4 +64,11 @@ class SpinLockGuardImpl : private boost::noncopyable { typedef SpinLockGuardImpl SpinLockGuard; +namespace detail { +template +struct HasLockUnlock; + +template <> +struct HasLockUnlock : public std::true_type {}; +} } diff --git a/folly/test/SynchronizedTest.cpp b/folly/test/SynchronizedTest.cpp index dd97d28c..375b0c16 100644 --- a/folly/test/SynchronizedTest.cpp +++ b/folly/test/SynchronizedTest.cpp @@ -19,9 +19,10 @@ // Test bed for folly/Synchronized.h #include -#include #include #include +#include +#include #include #include @@ -46,6 +47,7 @@ using SynchronizedTestTypes = testing::Types , boost::recursive_timed_mutex #endif , boost::shared_mutex + , folly::SpinLock #ifdef RW_SPINLOCK_USE_X86_INTRINSIC_ , folly::RWTicketSpinLock32 , folly::RWTicketSpinLock64