Commit 674533ad authored by Alan Frindell's avatar Alan Frindell Committed by Facebook Github Bot

Make NotificationQueue::Consumer::messageAvailable noexcept

Summary: There's a comment in that code that states that it *it* noexcept, and that is common for most folly async io callbacks.

Reviewed By: yfeldblum

Differential Revision: D4831800

fbshipit-source-id: 78894ad72504b9dfe540c14b8d7bbb29247aaf87
parent 120cc11d
......@@ -90,8 +90,7 @@ void AsyncServerSocket::RemoteAcceptor::stop(
}
void AsyncServerSocket::RemoteAcceptor::messageAvailable(
QueueMessage&& msg) {
QueueMessage&& msg) noexcept {
switch (msg.type) {
case MessageType::MSG_NEW_CONN:
{
......
......@@ -755,7 +755,7 @@ class AsyncServerSocket : public DelayedDestruction
void start(EventBase *eventBase, uint32_t maxAtOnce, uint32_t maxInQueue);
void stop(EventBase* eventBase, AcceptCallback* callback);
virtual void messageAvailable(QueueMessage&& message);
virtual void messageAvailable(QueueMessage&& message) noexcept override;
NotificationQueue<QueueMessage>* getQueue() {
return &queue_;
......
......@@ -40,7 +40,7 @@ namespace folly {
class EventBase::FunctionRunner
: public NotificationQueue<EventBase::Func>::Consumer {
public:
void messageAvailable(Func&& msg) override {
void messageAvailable(Func&& msg) noexcept override {
// In libevent2, internal events do not break the loop.
// Most users would expect loop(), followed by runInEventBaseThread(),
// to break the loop and check if it should exit or not.
......
......@@ -88,7 +88,7 @@ class NotificationQueue {
* messageAvailable() will be invoked whenever a new
* message is available from the pipe.
*/
virtual void messageAvailable(MessageT&& message) = 0;
virtual void messageAvailable(MessageT&& message) noexcept = 0;
/**
* Begin consuming messages from the specified queue.
......@@ -855,7 +855,7 @@ struct notification_queue_consumer_wrapper
: callback_(std::forward<UCallback>(callback)) {}
// we are being stricter here and requiring noexcept for callback
void messageAvailable(MessageT&& message) override {
void messageAvailable(MessageT&& message) noexcept override {
static_assert(
noexcept(std::declval<TCallback>()(std::forward<MessageT>(message))),
"callback must be declared noexcept, e.g.: `[]() noexcept {}`"
......
......@@ -38,7 +38,7 @@ class QueueConsumer : public IntQueue::Consumer {
public:
QueueConsumer() {}
void messageAvailable(int&& value) override {
void messageAvailable(int&& value) noexcept override {
messages.push_back(value);
if (fn) {
fn(value);
......@@ -360,7 +360,7 @@ void QueueTest::destroyCallback() {
// avoid destroying the function object.
class DestroyTestConsumer : public IntQueue::Consumer {
public:
void messageAvailable(int&& value) override {
void messageAvailable(int&& value) noexcept override {
DestructorGuard g(this);
if (fn && *fn) {
(*fn)(value);
......
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