cwNbMpScQueue.h/cpp: Added count().

This commit is contained in:
kevin 2024-03-25 14:29:25 -04:00
parent 693c87d598
commit c9281603de
2 changed files with 14 additions and 0 deletions

View File

@ -408,6 +408,18 @@ bool cw::nbmpscq::is_empty( handle_t h )
return next == nullptr;
}
unsigned cw::nbmpscq::count( handle_t h )
{
nbmpscq_t* p = _handleToPtr(h);
block_t* b = p->blockL;
int eleN = 0;
for(; b!=nullptr; b=b->link)
eleN += b->eleN.load(std::memory_order_acquire);
return eleN;
}
cw::rc_t cw::nbmpscq::test( const object_t* cfg )
{
rc_t rc=kOkRC,rc0,rc1;

View File

@ -71,6 +71,8 @@ namespace cw
bool is_empty( handle_t h );
unsigned count( handle_t h );
rc_t test( const object_t* cfg );
}