1
0
forked from Alepha/Alepha

Mailbox wouldBlock primitive.

This commit is contained in:
2024-01-04 00:37:17 -05:00
parent 7253432198
commit 005b5f8730

View File

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