forked from boostorg/beast
Reduce Beast dependencies by leveraging C++11 features:
* Remove beast::Atomic (RIPD-728): * Use std-provided alternatives * Eliminate atomic variables where possible * Cleanup beast::Thread interface: * Use std::string instead of beast::String * Remove unused functions and parameters * Remove unused code: * beast::ThreadLocalValue * beast::ServiceQueue
This commit is contained in:
1 parent
c01b4e6baa
commit
1d6721d345
20 files changed
+47
-2229
No files matched your search
@@ -247,31 +247,6 @@ std::uint32_t Time::getApproximateMillisecondCounter() noexcept
|
||||
return TimeHelpers::lastMSCounterValue;
|
||||
}
|
||||
|
||||
void Time::waitForMillisecondCounter (const std::uint32_t targetTime) noexcept
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
const std::uint32_t now = getMillisecondCounter();
|
||||
|
||||
if (now >= targetTime)
|
||||
break;
|
||||
|
||||
const int toWait = (int) (targetTime - now);
|
||||
|
||||
if (toWait > 2)
|
||||
{
|
||||
Thread::sleep (std::min (20, toWait >> 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
// xxx should consider using mutex_pause on the mac as it apparently
|
||||
// makes it seem less like a spinlock and avoids lowering the thread pri.
|
||||
for (int i = 10; --i >= 0;)
|
||||
std::this_thread::yield();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
double Time::highResolutionTicksToSeconds (const std::int64_t ticks) noexcept
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user