aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/session_job_count.cpp
blob: 768a3f58030396f8a4e4c232d75992301c2de29b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "session_job_count.h"

#include <util/system/yassert.h> 
 
using namespace NBus; 
using namespace NBus::NPrivate; 
 
TBusSessionJobCount::TBusSessionJobCount() 
    : JobCount(0) 
{
}
 
TBusSessionJobCount::~TBusSessionJobCount() { 
    Y_VERIFY(JobCount == 0, "must be 0 job count to destroy job");
} 
 
void TBusSessionJobCount::WaitForZero() { 
    TGuard<TMutex> guard(Mutex); 
    while (AtomicGet(JobCount) > 0) { 
        CondVar.WaitI(Mutex); 
    } 
}