FOLLY_ALWAYS_INLINE void unlock() const {
lock_.unlock();
}
- FOLLY_ALWAYS_INLINE bool trylock() const {
+ FOLLY_ALWAYS_INLINE bool try_lock() const {
return lock_.try_lock();
}
private:
FOLLY_ALWAYS_INLINE void unlock() const {
OSSpinLockUnlock(&lock_);
}
- FOLLY_ALWAYS_INLINE bool trylock() const {
+ FOLLY_ALWAYS_INLINE bool try_lock() const {
return OSSpinLockTry(&lock_);
}
private:
int rc = pthread_spin_unlock(&lock_);
checkPosixError(rc, "error unlocking spinlock");
}
- FOLLY_ALWAYS_INLINE bool trylock() const {
+ FOLLY_ALWAYS_INLINE bool try_lock() const {
int rc = pthread_spin_trylock(&lock_);
if (rc == 0) {
return true;
int rc = pthread_mutex_unlock(&lock_);
checkPosixError(rc, "error unlocking mutex");
}
- FOLLY_ALWAYS_INLINE bool trylock() const {
+ FOLLY_ALWAYS_INLINE bool try_lock() const {
int rc = pthread_mutex_trylock(&lock_);
if (rc == 0) {
return true;
NotificationQueue& operator=(NotificationQueue const &) = delete;
inline bool checkQueueSize(size_t maxSize, bool throws=true) const {
- DCHECK(0 == spinlock_.trylock());
+ DCHECK(0 == spinlock_.try_lock());
if (maxSize > 0 && queue_.size() >= maxSize) {
if (throws) {
throw std::overflow_error("unable to add message to NotificationQueue: "