mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[kernel] Fix clock period vs frequency error
Calling `spinwait()` was hanging due to improper computation of the clock rate because justin did a dumb at math. Also the period can be greater than 1ns, so the clock's units were updated to microseconds.
This commit is contained in:
@@ -14,9 +14,9 @@ clock::clock(uint64_t rate, clock::source source_func, void *data) :
|
||||
}
|
||||
|
||||
void
|
||||
clock::spinwait(uint64_t ns) const
|
||||
clock::spinwait(uint64_t us) const
|
||||
{
|
||||
uint64_t when = m_source(m_data) + ns;
|
||||
uint64_t when = m_source(m_data) + us;
|
||||
while (value() < when);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user