You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/04/26 08:49:58 UTC

[GitHub] andrzej-kaczmarek closed pull request #1050: kernel/os: Make os_callout_remaining_ticks thread-safe

andrzej-kaczmarek closed pull request #1050:  kernel/os: Make os_callout_remaining_ticks thread-safe
URL: https://github.com/apache/mynewt-core/pull/1050
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/kernel/os/src/os_callout.c b/kernel/os/src/os_callout.c
index eb2c59b21a..b4d0d72224 100644
--- a/kernel/os/src/os_callout.c
+++ b/kernel/os/src/os_callout.c
@@ -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;
 }
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services