You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2018/10/31 20:37:27 UTC
[mynewt-core] branch master updated: kernel/os: Ensure callout
initialized upon reset
This is an automated email from the ASF dual-hosted git repository.
ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
The following commit(s) were added to refs/heads/master by this push:
new 1f840ea kernel/os: Ensure callout initialized upon reset
1f840ea is described below
commit 1f840ea106cf8cf870042429205467f5fea4f6d7
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Wed Oct 31 13:11:14 2018 -0700
kernel/os: Ensure callout initialized upon reset
It is an error to reset a callout prior to initializing it, as it has no
event queue to post to on expiry.
Now, `os_callout_reset()` asserts that the provided callout has been
initailized.
---
kernel/os/src/os_callout.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/os/src/os_callout.c b/kernel/os/src/os_callout.c
index 53ffe1a..77a5ef6 100644
--- a/kernel/os/src/os_callout.c
+++ b/kernel/os/src/os_callout.c
@@ -71,6 +71,9 @@ os_callout_reset(struct os_callout *c, os_time_t ticks)
os_sr_t sr;
int ret;
+ /* Ensure this callout has been initialized. */
+ assert(c->c_evq != NULL);
+
os_trace_api_u32x2(OS_TRACE_ID_CALLOUT_RESET, (uint32_t)c, (uint32_t)ticks);
if (ticks > INT32_MAX) {