MCPcopy Create free account
hub / github.com/3rdparty/libprocess / await

Method await

src/latch.cpp:57–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55
56
57bool Latch::await(const Duration& duration)
58{
59 if (!triggered.load()) {
60 process::wait(pid, duration); // Explict to disambiguate.
61 // It's possible that we failed to wait because:
62 // (1) Our process has already terminated.
63 // (2) We timed out (i.e., duration was not "infinite").
64
65 // In the event of (1) we might need to return 'true' since a
66 // terminated process might imply that the latch has been
67 // triggered. To capture this we simply return the value of
68 // 'triggered' (which will also capture cases where we actually
69 // timed out but have since triggered, which seems like an
70 // acceptable semantics given such a "tie").
71 return triggered.load();
72 }
73
74 return true;
75}
76
77} // namespace process {

Callers 2

TEST_FFunction · 0.45
TESTFunction · 0.45

Calls 1

waitFunction · 0.70

Tested by 2

TEST_FFunction · 0.36
TESTFunction · 0.36