kernel/os: Make os_callout_remaining_ticks thread-safe
This makes it consistent with other callout APIs.
@@ -170,9 +170,10 @@ os_callout_wakeup_ticks(os_time_t now)
os_time_t
os_callout_remaining_ticks(struct os_callout *c, os_time_t now)
{
+ os_sr_t sr;
os_time_t rt;
- OS_ASSERT_CRITICAL();
+ OS_ENTER_CRITICAL(sr);
if (OS_TIME_TICK_GEQ(c->c_ticks, now)) {
rt = c->c_ticks - now;
@@ -180,6 +181,8 @@ os_callout_remaining_ticks(struct os_callout *c, os_time_t now)
rt = 0; /* callout time is in the past */
}
+ OS_EXIT_CRITICAL(sr);
+
return rt;
}
