|
101 | 101 | // is held. See https://github.com/boostorg/thread/blob/master/
|
102 | 102 | // include/boost/thread/pthread/shared_mutex.hpp
|
103 | 103 | //
|
104 |
| -// * RWSpinLock::UpgradedHolder maps to SharedMutex::UpgradeHolder |
105 |
| -// (UpgradeableHolder would be even more pedantically correct). |
106 |
| -// SharedMutex's holders have fewer methods (no reset) and are less |
107 |
| -// tolerant (promotion and downgrade crash if the donor doesn't own |
108 |
| -// the lock, and you must use the default constructor rather than |
109 |
| -// passing a nullptr to the pointer constructor). |
110 |
| -// |
111 | 104 | // Both SharedMutex and RWSpinLock provide "exclusive", "upgrade",
|
112 | 105 | // and "shared" modes. At all times num_threads_holding_exclusive +
|
113 | 106 | // num_threads_holding_upgrade <= 1, and num_threads_holding_exclusive ==
|
|
193 | 186 | // recorded the lock, which might be in the lock itself or in any of
|
194 | 187 | // the shared slots. If you can conveniently pass state from lock
|
195 | 188 | // acquisition to release then the fastest mechanism is to std::move
|
196 |
| -// the SharedMutex::ReadHolder instance or an SharedMutex::Token (using |
| 189 | +// the std::shared_lock instance or an SharedMutex::Token (using |
197 | 190 | // lock_shared(Token&) and unlock_shared(Token&)). The guard or token
|
198 | 191 | // will tell unlock_shared where in deferredReaders[] to look for the
|
199 | 192 | // deferred lock. The Token-less version of unlock_shared() works in all
|
@@ -1433,7 +1426,7 @@ class SharedMutexImpl : std::conditional_t<
|
1433 | 1426 | }
|
1434 | 1427 |
|
1435 | 1428 | public:
|
1436 |
| - class FOLLY_NODISCARD ReadHolder { |
| 1429 | + class FOLLY_NODISCARD FOLLY_DEPRECATED("use std::shared_lock") ReadHolder { |
1437 | 1430 | using folly_is_unsafe_for_async_usage = std::true_type;
|
1438 | 1431 |
|
1439 | 1432 | ReadHolder() : lock_(nullptr) {}
|
@@ -1495,7 +1488,8 @@ class SharedMutexImpl : std::conditional_t<
|
1495 | 1488 | SharedMutexToken token_;
|
1496 | 1489 | };
|
1497 | 1490 |
|
1498 |
| - class FOLLY_NODISCARD UpgradeHolder { |
| 1491 | + class FOLLY_NODISCARD FOLLY_DEPRECATED("use folly::upgrade_lock") |
| 1492 | + UpgradeHolder { |
1499 | 1493 | using folly_is_unsafe_for_async_usage = std::true_type;
|
1500 | 1494 |
|
1501 | 1495 | UpgradeHolder() : lock_(nullptr) {}
|
@@ -1545,7 +1539,7 @@ class SharedMutexImpl : std::conditional_t<
|
1545 | 1539 | SharedMutexImpl* lock_;
|
1546 | 1540 | };
|
1547 | 1541 |
|
1548 |
| - class FOLLY_NODISCARD WriteHolder { |
| 1542 | + class FOLLY_NODISCARD FOLLY_DEPRECATED("use std::unique_lock") WriteHolder { |
1549 | 1543 | using folly_is_unsafe_for_async_usage = std::true_type;
|
1550 | 1544 |
|
1551 | 1545 | WriteHolder() : lock_(nullptr) {}
|
|
0 commit comments