MCPcopy Create free account
hub / github.com/apache/brpc / VerifyPoolRunner

Class VerifyPoolRunner

test/simple_thread_unittest.cc:57–75  ·  view source on GitHub ↗

We count up on a sequence number, firing on the event when we've hit our expected amount, otherwise we wait on the event. This will ensure that we have all threads outstanding until we hit our expected thread pool size.

Source from the content-addressed store, hash-verified

55// expected amount, otherwise we wait on the event. This will ensure that we
56// have all threads outstanding until we hit our expected thread pool size.
57class VerifyPoolRunner : public DelegateSimpleThread::Delegate {
58 public:
59 VerifyPoolRunner(AtomicSequenceNumber* seq,
60 int total, WaitableEvent* event)
61 : seq_(seq), total_(total), event_(event) { }
62
63 virtual void Run() OVERRIDE {
64 if (seq_->GetNext() == total_) {
65 event_->Signal();
66 } else {
67 event_->Wait();
68 }
69 }
70
71 private:
72 AtomicSequenceNumber* seq_;
73 int total_;
74 WaitableEvent* event_;
75};
76
77} // namespace
78

Callers

nothing calls this directly

Calls 3

GetNextMethod · 0.45
SignalMethod · 0.45
WaitMethod · 0.45

Tested by

no test coverage detected