}
void AsyncServerSocket::RemoteAcceptor::messageAvailable(
- QueueMessage&& msg) {
-
+ QueueMessage&& msg) noexcept {
switch (msg.type) {
case MessageType::MSG_NEW_CONN:
{
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_;
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.
* 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.
: 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 {}`"
public:
QueueConsumer() {}
- void messageAvailable(int&& value) override {
+ void messageAvailable(int&& value) noexcept override {
messages.push_back(value);
if (fn) {
fn(value);
// 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);