use uint_least32_t instead of long for timeout
This commit is contained in:
parent
79937c9495
commit
866821765a
@ -75,7 +75,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool timed_wait(PosixMutex &mutex, long timeout_us) noexcept {
|
bool timed_wait(PosixMutex &mutex, uint_least32_t timeout_us) noexcept {
|
||||||
struct timeval now;
|
struct timeval now;
|
||||||
gettimeofday(&now, nullptr);
|
gettimeofday(&now, nullptr);
|
||||||
|
|
||||||
@ -97,8 +97,8 @@ public:
|
|||||||
auto timeout_us = std::chrono::duration_cast<std::chrono::microseconds>(timeout).count();
|
auto timeout_us = std::chrono::duration_cast<std::chrono::microseconds>(timeout).count();
|
||||||
if (timeout_us < 0)
|
if (timeout_us < 0)
|
||||||
timeout_us = 0;
|
timeout_us = 0;
|
||||||
else if (timeout_us > std::numeric_limits<long>::max())
|
else if (timeout_us > std::numeric_limits<uint_least32_t>::max())
|
||||||
timeout_us = std::numeric_limits<long>::max();
|
timeout_us = std::numeric_limits<uint_least32_t>::max();
|
||||||
|
|
||||||
return timed_wait(mutex, timeout_us);
|
return timed_wait(mutex, timeout_us);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user