Minor fixup in <ratio> and add optional support for shared_mutex and upgrade_mutex which must be opted into with #define _LIBCPP_SHARED_LOCK
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@120258 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d397d03651
commit
ac417faebc
@ -18,6 +18,16 @@
|
|||||||
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
|
||||||
|
#ifdef _LIBCPP_SHARED_LOCK
|
||||||
|
|
||||||
|
namespace ting {
|
||||||
|
template <class> class shared_lock;
|
||||||
|
template <class> class upgrade_lock;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // _LIBCPP_SHARED_LOCK
|
||||||
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
class _LIBCPP_VISIBLE mutex
|
class _LIBCPP_VISIBLE mutex
|
||||||
@ -143,6 +153,28 @@ public:
|
|||||||
__u.__owns_ = false;
|
__u.__owns_ = false;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _LIBCPP_SHARED_LOCK
|
||||||
|
|
||||||
|
unique_lock(ting::shared_lock<mutex_type>&&, try_to_lock_t);
|
||||||
|
template <class _Clock, class _Duration>
|
||||||
|
unique_lock(ting::shared_lock<mutex_type>&&,
|
||||||
|
const chrono::time_point<_Clock, _Duration>&);
|
||||||
|
template <class _Rep, class _Period>
|
||||||
|
unique_lock(ting::shared_lock<mutex_type>&&,
|
||||||
|
const chrono::duration<_Rep, _Period>&);
|
||||||
|
|
||||||
|
explicit unique_lock(ting::upgrade_lock<mutex_type>&&);
|
||||||
|
unique_lock(ting::upgrade_lock<mutex_type>&&, try_to_lock_t);
|
||||||
|
template <class _Clock, class _Duration>
|
||||||
|
unique_lock(ting::upgrade_lock<mutex_type>&&,
|
||||||
|
const chrono::time_point<_Clock, _Duration>&);
|
||||||
|
template <class _Rep, class _Period>
|
||||||
|
unique_lock(ting::upgrade_lock<mutex_type>&&,
|
||||||
|
const chrono::duration<_Rep, _Period>&);
|
||||||
|
|
||||||
|
#endif // _LIBCPP_SHARED_LOCK
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
void lock();
|
void lock();
|
||||||
|
@ -276,10 +276,7 @@ public:
|
|||||||
|
|
||||||
template <class _R1, class _R2>
|
template <class _R1, class _R2>
|
||||||
struct _LIBCPP_VISIBLE ratio_multiply
|
struct _LIBCPP_VISIBLE ratio_multiply
|
||||||
: public __ratio_multiply<_R1, _R2>::type
|
: public __ratio_multiply<_R1, _R2>::type {};
|
||||||
{
|
|
||||||
typedef typename __ratio_multiply<_R1, _R2>::type type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class _R1, class _R2>
|
template <class _R1, class _R2>
|
||||||
struct __ratio_divide
|
struct __ratio_divide
|
||||||
@ -297,10 +294,7 @@ public:
|
|||||||
|
|
||||||
template <class _R1, class _R2>
|
template <class _R1, class _R2>
|
||||||
struct _LIBCPP_VISIBLE ratio_divide
|
struct _LIBCPP_VISIBLE ratio_divide
|
||||||
: public __ratio_divide<_R1, _R2>::type
|
: public __ratio_divide<_R1, _R2>::type {};
|
||||||
{
|
|
||||||
typedef typename __ratio_divide<_R1, _R2>::type type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class _R1, class _R2>
|
template <class _R1, class _R2>
|
||||||
struct __ratio_add
|
struct __ratio_add
|
||||||
@ -326,10 +320,7 @@ public:
|
|||||||
|
|
||||||
template <class _R1, class _R2>
|
template <class _R1, class _R2>
|
||||||
struct _LIBCPP_VISIBLE ratio_add
|
struct _LIBCPP_VISIBLE ratio_add
|
||||||
: public __ratio_add<_R1, _R2>::type
|
: public __ratio_add<_R1, _R2>::type {};
|
||||||
{
|
|
||||||
typedef typename __ratio_add<_R1, _R2>::type type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class _R1, class _R2>
|
template <class _R1, class _R2>
|
||||||
struct __ratio_subtract
|
struct __ratio_subtract
|
||||||
@ -355,10 +346,7 @@ public:
|
|||||||
|
|
||||||
template <class _R1, class _R2>
|
template <class _R1, class _R2>
|
||||||
struct _LIBCPP_VISIBLE ratio_subtract
|
struct _LIBCPP_VISIBLE ratio_subtract
|
||||||
: public __ratio_subtract<_R1, _R2>::type
|
: public __ratio_subtract<_R1, _R2>::type {};
|
||||||
{
|
|
||||||
typedef typename __ratio_subtract<_R1, _R2>::type type;
|
|
||||||
};
|
|
||||||
|
|
||||||
// ratio_equal
|
// ratio_equal
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user