Skip to content

Commit

Permalink
core/semaphore: Add semaphore_units::release()
Browse files Browse the repository at this point in the history
Message-Id: <[email protected]>
  • Loading branch information
tgrabiec authored and avikivity committed Oct 12, 2016
1 parent 04dc20c commit 8945d64
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/semaphore.hh
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,12 @@ public:
_sem.signal(_n);
}
}
/// Releases ownership of the units. The semaphore will not be signalled.
///
/// \return the number of units held
size_t release() {
return std::exchange(_n, 0);
}
};

/// \brief Take units from semaphore temporarily
Expand Down

0 comments on commit 8945d64

Please sign in to comment.