You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2016/11/22 01:17:10 UTC

[11/27] incubator-mynewt-core git commit: oci; oc_main_poll() does not expect you to call into it periodically.

oci; oc_main_poll() does not expect you to call into it periodically.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/6e25f3f3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/6e25f3f3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/6e25f3f3

Branch: refs/heads/develop
Commit: 6e25f3f34d6f844ea1bb4151c71618f4e0aef845
Parents: 7c67f1c
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Wed Nov 16 16:57:32 2016 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Mon Nov 21 17:15:48 2016 -0800

----------------------------------------------------------------------
 apps/ocf_sample/src/main.c | 12 ++----------
 mgmt/oicmgr/src/oicmgr.c   | 13 +------------
 2 files changed, 3 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6e25f3f3/apps/ocf_sample/src/main.c
----------------------------------------------------------------------
diff --git a/apps/ocf_sample/src/main.c b/apps/ocf_sample/src/main.c
index 0e8ebe4..e423863 100644
--- a/apps/ocf_sample/src/main.c
+++ b/apps/ocf_sample/src/main.c
@@ -247,16 +247,8 @@ ocf_main_task_handler(void *arg)
     os_callout_init(&callout, &ocf_aux_evq, stop_observe, NULL);
 #endif
     while (1) {
-        uint32_t ticks;
-        oc_clock_time_t next_event;
-        next_event = oc_main_poll();
-        ticks = oc_clock_time();
-        if (next_event == 0) {
-            ticks = OS_TIMEOUT_NEVER;
-        } else {
-            ticks = next_event - ticks;
-        }
-        os_sem_pend(&ocf_main_loop_sem, ticks);
+        oc_main_poll();
+        os_sem_pend(&ocf_main_loop_sem, OS_TIMEOUT_NEVER);
     }
     oc_main_shutdown();
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6e25f3f3/mgmt/oicmgr/src/oicmgr.c
----------------------------------------------------------------------
diff --git a/mgmt/oicmgr/src/oicmgr.c b/mgmt/oicmgr/src/oicmgr.c
index 0e631ef..4557189 100644
--- a/mgmt/oicmgr/src/oicmgr.c
+++ b/mgmt/oicmgr/src/oicmgr.c
@@ -43,7 +43,6 @@ struct omgr_cbuf {
 struct omgr_state {
     struct os_eventq *os_evq;
     struct os_event os_event;
-    struct os_callout os_oc_timer;
     struct os_task os_task;
     struct omgr_cbuf os_cbuf;		/* CBOR buffer for NMGR task */
 };
@@ -232,15 +231,7 @@ oc_signal_main_loop(void)
 static void
 omgr_process_oc_event(struct os_event *ev)
 {
-    struct omgr_state *o = &omgr_state;
-    os_time_t next_event;
-
-    next_event = oc_main_poll();
-    if (next_event) {
-        os_callout_reset(&o->os_oc_timer, next_event - os_time_get());
-    } else {
-        os_callout_stop(&o->os_oc_timer);
-    }
+    oc_main_poll();
 }
 
 static void
@@ -251,8 +242,6 @@ omgr_event_start(struct os_event *ev)
     oc_main_init((oc_handler_t *)&omgr_oc_handler);
     os_eventq_ensure(&o->os_evq, NULL);
     o->os_event.ev_cb = omgr_process_oc_event;
-    os_callout_init(&o->os_oc_timer, mgmt_evq_get(), omgr_process_oc_event,
-      NULL);
 }
 
 int