Commit 87520af5 authored by Adam Simpkins's avatar Adam Simpkins Committed by JoelMarcey

update call sites to use SpinLock

Summary:
Update call sites to use the new folly::SpinLock name, instead of
folly::io::PortableSpinLock.

Test Plan: Built and ran the folly unit tests.

Reviewed By: davejwatson@fb.com

Subscribers: doug, net-systems@, exa, folly-diffs@

FB internal diff: D1734647

Signature: t1:1734647:1418334925:1bbcffccd06907224de2a102f8d4bfbe1bd62fd1
parent 4494e275
......@@ -33,9 +33,9 @@
#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;
......@@ -44,9 +44,9 @@ using std::shared_ptr;
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;
......@@ -62,7 +62,7 @@ size_t MIN_WRITE_SIZE = 1500;
// 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;
......@@ -494,7 +494,7 @@ void AsyncSSLSocket::attachSSLContext(
// 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());
}
......@@ -509,7 +509,7 @@ void AsyncSSLSocket::detachSSLContext() {
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
......
......@@ -19,12 +19,12 @@
#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>
......@@ -379,7 +379,7 @@ class NotificationQueue {
try {
folly::io::PortableSpinLockGuard g(spinlock_);
folly::SpinLockGuard g(spinlock_);
if (UNLIKELY(queue_.empty())) {
return false;
......@@ -403,7 +403,7 @@ class NotificationQueue {
}
int size() {
folly::io::PortableSpinLockGuard g(spinlock_);
folly::SpinLockGuard g(spinlock_);
return queue_.size();
}
......@@ -505,7 +505,7 @@ class NotificationQueue {
checkPid();
bool signal = false;
{
folly::io::PortableSpinLockGuard g(spinlock_);
folly::SpinLockGuard g(spinlock_);
if (checkDraining(throws) || !checkQueueSize(maxSize, throws)) {
return false;
}
......@@ -529,7 +529,7 @@ class NotificationQueue {
checkPid();
bool signal = false;
{
folly::io::PortableSpinLockGuard g(spinlock_);
folly::SpinLockGuard g(spinlock_);
if (checkDraining(throws) || !checkQueueSize(maxSize, throws)) {
return false;
}
......@@ -551,7 +551,7 @@ class NotificationQueue {
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()));
......@@ -567,7 +567,7 @@ class NotificationQueue {
}
}
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_;
......@@ -730,7 +730,7 @@ void NotificationQueue<MessageT>::Consumer::init(
queue_ = queue;
{
folly::io::PortableSpinLockGuard g(queue_->spinlock_);
folly::SpinLockGuard g(queue_->spinlock_);
queue_->numConsumers_++;
}
queue_->signalEvent();
......@@ -750,7 +750,7 @@ void NotificationQueue<MessageT>::Consumer::stopConsuming() {
}
{
folly::io::PortableSpinLockGuard g(queue_->spinlock_);
folly::SpinLockGuard g(queue_->spinlock_);
queue_->numConsumers_--;
setActive(false);
}
......@@ -764,7 +764,7 @@ void NotificationQueue<MessageT>::Consumer::stopConsuming() {
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;
}
......@@ -772,7 +772,7 @@ bool NotificationQueue<MessageT>::Consumer::consumeUntilDrained() noexcept {
}
consumeMessages(true);
{
folly::io::PortableSpinLockGuard g(queue_->spinlock_);
folly::SpinLockGuard g(queue_->spinlock_);
queue_->draining_ = false;
}
return true;
......
......@@ -22,7 +22,7 @@
#include <openssl/x509v3.h>
#include <folly/Format.h>
#include <folly/io/PortableSpinLock.h>
#include <folly/SpinLock.h>
// ---------------------------------------------------------------------
// SSLContext implementation
......@@ -534,7 +534,7 @@ struct SSLLock {
}
SSLContext::SSLLockType lockType;
folly::io::PortableSpinLock spinLock{};
folly::SpinLock spinLock{};
std::mutex mutex;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment