Warning, file /DD4hep/DDDigi/src/DigiSemaphore.cpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <DDDigi/DigiSemaphore.h>
0016
0017 using namespace dd4hep::digi;
0018
0019
0020 std::unique_lock<std::mutex> DigiSemaphore::wait_null() {
0021 std::unique_lock<std::mutex> protect(this->lock);
0022 this->reference_count_is_null.wait(protect, [this] { return this->reference_count == 0; } );
0023 return protect;
0024 }
0025
0026
0027 void DigiSemaphore::aquire() {
0028 std::lock_guard guard(this->lock);
0029 ++this->reference_count;
0030 }
0031
0032
0033 void DigiSemaphore::release() {
0034 if ( --this->reference_count == 0 )
0035 this->reference_count_is_null.notify_one();
0036 }