| 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 < |
nothing calls this directly
no test coverage detected