#include <folly/Bits.h>
#include <folly/SocketAddress.h>
+#include <folly/SpinLock.h>
#include <folly/io/IOBuf.h>
#include <folly/io/Cursor.h>
-#include <folly/io/PortableSpinLock.h>
using folly::SocketAddress;
using folly::SSLContext;
using folly::Endian;
using folly::IOBuf;
+using folly::SpinLock;
+using folly::SpinLockGuard;
using folly::io::Cursor;
-using folly::io::PortableSpinLock;
-using folly::io::PortableSpinLockGuard;
using std::unique_ptr;
using std::bind;
// We have one single dummy SSL context so that we can implement attach
// and detach methods in a thread safe fashion without modifying opnessl.
static SSLContext *dummyCtx = nullptr;
-static PortableSpinLock dummyCtxLock;
+static SpinLock dummyCtxLock;
// Numbers chosen as to not collide with functions in ssl.h
const uint8_t TASYNCSSLSOCKET_F_PERFORM_READ = 90;
// In order to call attachSSLContext, detachSSLContext must have been
// previously called which sets the socket's context to the dummy
// context. Thus we must acquire this lock.
- PortableSpinLockGuard guard(dummyCtxLock);
+ SpinLockGuard guard(dummyCtxLock);
SSL_set_SSL_CTX(ssl_, ctx->getSSLCtx());
}
ssl_->initial_ctx = nullptr;
}
#endif
- PortableSpinLockGuard guard(dummyCtxLock);
+ SpinLockGuard guard(dummyCtxLock);
if (nullptr == dummyCtx) {
// We need to lazily initialize the dummy context so we don't
// accidentally override any programmatic settings to openssl
#include <fcntl.h>
#include <unistd.h>
-#include <folly/io/PortableSpinLock.h>
#include <folly/io/async/EventBase.h>
#include <folly/io/async/EventHandler.h>
#include <folly/io/async/Request.h>
#include <folly/Likely.h>
#include <folly/ScopeGuard.h>
+#include <folly/SpinLock.h>
#include <glog/logging.h>
#include <deque>
try {
- folly::io::PortableSpinLockGuard g(spinlock_);
+ folly::SpinLockGuard g(spinlock_);
if (UNLIKELY(queue_.empty())) {
return false;
}
int size() {
- folly::io::PortableSpinLockGuard g(spinlock_);
+ folly::SpinLockGuard g(spinlock_);
return queue_.size();
}
checkPid();
bool signal = false;
{
- folly::io::PortableSpinLockGuard g(spinlock_);
+ folly::SpinLockGuard g(spinlock_);
if (checkDraining(throws) || !checkQueueSize(maxSize, throws)) {
return false;
}
checkPid();
bool signal = false;
{
- folly::io::PortableSpinLockGuard g(spinlock_);
+ folly::SpinLockGuard g(spinlock_);
if (checkDraining(throws) || !checkQueueSize(maxSize, throws)) {
return false;
}
bool signal = false;
size_t numAdded = 0;
{
- folly::io::PortableSpinLockGuard g(spinlock_);
+ folly::SpinLockGuard g(spinlock_);
checkDraining();
while (first != last) {
queue_.push_back(std::make_pair(*first, RequestContext::saveContext()));
}
}
- mutable folly::io::PortableSpinLock spinlock_;
+ mutable folly::SpinLock spinlock_;
int eventfd_;
int pipeFds_[2]; // to fallback to on older/non-linux systems
uint32_t advisoryMaxQueueSize_;
queue_ = queue;
{
- folly::io::PortableSpinLockGuard g(queue_->spinlock_);
+ folly::SpinLockGuard g(queue_->spinlock_);
queue_->numConsumers_++;
}
queue_->signalEvent();
}
{
- folly::io::PortableSpinLockGuard g(queue_->spinlock_);
+ folly::SpinLockGuard g(queue_->spinlock_);
queue_->numConsumers_--;
setActive(false);
}
template<typename MessageT>
bool NotificationQueue<MessageT>::Consumer::consumeUntilDrained() noexcept {
{
- folly::io::PortableSpinLockGuard g(queue_->spinlock_);
+ folly::SpinLockGuard g(queue_->spinlock_);
if (queue_->draining_) {
return false;
}
}
consumeMessages(true);
{
- folly::io::PortableSpinLockGuard g(queue_->spinlock_);
+ folly::SpinLockGuard g(queue_->spinlock_);
queue_->draining_ = false;
}
return true;
#include <openssl/x509v3.h>
#include <folly/Format.h>
-#include <folly/io/PortableSpinLock.h>
+#include <folly/SpinLock.h>
// ---------------------------------------------------------------------
// SSLContext implementation
}
SSLContext::SSLLockType lockType;
- folly::io::PortableSpinLock spinLock{};
+ folly::SpinLock spinLock{};
std::mutex mutex;
};