| 1586 | } |
| 1587 | |
| 1588 | void Timer::stub() |
| 1589 | { |
| 1590 | auto timeout = _default_timeout; |
| 1591 | do { |
| 1592 | again: |
| 1593 | _waiting = true; |
| 1594 | _wait_ready.notify_all(); |
| 1595 | int ret = thread_usleep(timeout); |
| 1596 | _waiting = false; |
| 1597 | if (ret < 0) |
| 1598 | { |
| 1599 | int e = errno; |
| 1600 | if (e == ECANCELED) { |
| 1601 | break; |
| 1602 | } else if (e == EAGAIN) { |
| 1603 | timeout = _reset_timeout; |
| 1604 | goto again; |
| 1605 | } |
| 1606 | else assert(false); |
| 1607 | } |
| 1608 | |
| 1609 | timeout = _on_timer.fire(); |
| 1610 | if (!timeout) |
| 1611 | timeout = _default_timeout; |
| 1612 | } while(_repeating); |
| 1613 | _th = nullptr; |
| 1614 | } |
| 1615 | void* Timer::_stub(void* _this) |
| 1616 | { |
| 1617 | static_cast<Timer*>(_this)->stub(); |
no test coverage detected