MCPcopy Create free account
hub / github.com/davisking/dlib / wait_for_value

Method wait_for_value

dlib/test/timer.cpp:110–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108
109 private:
110 bool wait_for_value (
111 const int& value,
112 int expected_value,
113 unsigned long timeout_ms
114 )
115 {
116 const uint64 timeout_time = ts.get_timestamp() +
117 static_cast<uint64>(timeout_ms)*1000;
118 auto_mutex lock(m);
119
120 while (value < expected_value)
121 {
122 const uint64 current_time = ts.get_timestamp();
123 if (current_time >= timeout_time)
124 return false;
125
126 const uint64 remaining_microseconds = timeout_time - current_time;
127 const unsigned long remaining_milliseconds = static_cast<unsigned long>(
128 (remaining_microseconds + 999)/1000
129 );
130 count_changed.wait_or_timeout(remaining_milliseconds);
131 }
132 return true;
133 }
134 };
135
136 template <

Callers

nothing calls this directly

Calls 2

get_timestampMethod · 0.80
wait_or_timeoutMethod · 0.45

Tested by

no test coverage detected