Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop 35b0a91b1 -> 88191c27f


MYNEWT-292

Add an assert checking that same prio is not used by two different
tasks.


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/0f1ec97b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/0f1ec97b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/0f1ec97b

Branch: refs/heads/develop
Commit: 0f1ec97bc26c509ea0e5fe0e738fdeeb9c899576
Parents: 1d2d46b
Author: Fabio Utzig <ut...@utzig.org>
Authored: Wed Feb 8 14:24:32 2017 -0800
Committer: Fabio Utzig <ut...@utzig.org>
Committed: Wed Feb 8 15:06:08 2017 -0800

----------------------------------------------------------------------
 hw/mcu/native/pkg.yml          | 2 +-
 kernel/os/include/os/os_task.h | 2 +-
 kernel/os/src/os_task.c        | 5 +++++
 3 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0f1ec97b/hw/mcu/native/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/mcu/native/pkg.yml b/hw/mcu/native/pkg.yml
index d86e149..7094340 100644
--- a/hw/mcu/native/pkg.yml
+++ b/hw/mcu/native/pkg.yml
@@ -28,6 +28,6 @@ pkg.keywords:
 pkg.deps:
     - hw/hal
     - compiler/sim
-    
+
 pkg.req_apis:
     - console

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0f1ec97b/kernel/os/include/os/os_task.h
----------------------------------------------------------------------
diff --git a/kernel/os/include/os/os_task.h b/kernel/os/include/os/os_task.h
index a9253ba..64c0850 100644
--- a/kernel/os/include/os/os_task.h
+++ b/kernel/os/include/os/os_task.h
@@ -45,7 +45,7 @@ struct os_task_obj
 
 /* Task states */
 typedef enum os_task_state {
-    OS_TASK_READY = 1, 
+    OS_TASK_READY = 1,
     OS_TASK_SLEEP = 2,
     OS_TASK_SUSPEND = 3
 } os_task_state_t;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0f1ec97b/kernel/os/src/os_task.c
----------------------------------------------------------------------
diff --git a/kernel/os/src/os_task.c b/kernel/os/src/os_task.c
index 277e4bc..f3106bd 100644
--- a/kernel/os/src/os_task.c
+++ b/kernel/os/src/os_task.c
@@ -98,6 +98,7 @@ os_task_init(struct os_task *t, const char *name, 
os_task_func_t func,
 {
     struct os_sanity_check *sc;
     int rc;
+    struct os_task *task;
 
     memset(t, 0, sizeof(*t));
 
@@ -132,6 +133,10 @@ os_task_init(struct os_task *t, const char *name, 
os_task_func_t func,
     t->t_stacktop = &stack_bottom[stack_size];
     t->t_stacksize = stack_size;
 
+    STAILQ_FOREACH(task, &g_os_task_list, t_os_task_list) {
+        assert(t->t_prio != task->t_prio);
+    }
+
     /* insert this task into the task list */
     STAILQ_INSERT_TAIL(&g_os_task_list, t, t_os_task_list);
 

Reply via email to