forked from Alepha/Alepha
Mailbox wouldBlock
primitive.
This commit is contained in:
@ -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 );
|
||||
|
Reference in New Issue
Block a user