diff --git a/Atomic/Mailbox.h b/Atomic/Mailbox.h index 8cd0684..12ac6ba 100644 --- a/Atomic/Mailbox.h +++ b/Atomic/Mailbox.h @@ -197,6 +197,8 @@ namespace Alepha::Hydrogen::Atomic ::detail:: Mailbox_m return std::move( *pos++ ); } + bool pushWouldBlock() const noexcept { return weight > boxLimit; } + /*! * @brief This function will add mail to the mailbox. * @@ -210,7 +212,7 @@ namespace Alepha::Hydrogen::Atomic ::detail:: Mailbox_m void push( Item item ) { - if( weight > boxLimit ) + if( pushWouldBlock() ) { [[unlikely]]; Alepha::unique_lock lock( access );