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/01/04 21:17:51 UTC

[GitHub] wes3 closed pull request #717: Revert changes for mynewt-879

wes3 closed pull request #717: Revert changes for mynewt-879
URL: https://github.com/apache/mynewt-core/pull/717
 
 
   

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_sched.c b/kernel/os/src/os_sched.c
index 50a64eb96..cb0b02063 100644
--- a/kernel/os/src/os_sched.c
+++ b/kernel/os/src/os_sched.c
@@ -64,22 +64,16 @@ os_sched_insert(struct os_task *t)
 
     entry = NULL;
     OS_ENTER_CRITICAL(sr);
-
-    /* If run list empty, add to front */
-    if (TAILQ_EMPTY(&g_os_run_list)) {
-        TAILQ_INSERT_HEAD(&g_os_run_list, t, t_os_list);
-    } else {
-        TAILQ_FOREACH(entry, &g_os_run_list, t_os_list) {
-            if (t->t_prio < entry->t_prio) {
-                break;
-            }
-        }
-        if (entry) {
-            TAILQ_INSERT_BEFORE(entry, (struct os_task *) t, t_os_list);
-        } else {
-            TAILQ_INSERT_TAIL(&g_os_run_list, (struct os_task *) t, t_os_list);
+    TAILQ_FOREACH(entry, &g_os_run_list, t_os_list) {
+        if (t->t_prio < entry->t_prio) {
+            break;
         }
     }
+    if (entry) {
+        TAILQ_INSERT_BEFORE(entry, (struct os_task *) t, t_os_list);
+    } else {
+        TAILQ_INSERT_TAIL(&g_os_run_list, (struct os_task *) t, t_os_list);
+    }
     OS_EXIT_CRITICAL(sr);
 
     return (0);
@@ -183,18 +177,8 @@ os_sched_sleep(struct os_task *t, os_time_t nticks)
     TAILQ_REMOVE(&g_os_run_list, t, t_os_list);
     t->t_state = OS_TASK_SLEEP;
     t->t_next_wakeup = os_time_get() + nticks;
-
     if (nticks == OS_TIMEOUT_NEVER) {
         t->t_flags |= OS_TASK_FLAG_NO_TIMEOUT;
-    }
-
-    /* If sleep list empty, add to front */
-    if (TAILQ_EMPTY(&g_os_sleep_list)) {
-        TAILQ_INSERT_HEAD(&g_os_sleep_list, t, t_os_list);
-        goto exit_sched_sleep;
-    }
-
-    if (nticks == OS_TIMEOUT_NEVER) {
         TAILQ_INSERT_TAIL(&g_os_sleep_list, t, t_os_list);
     } else {
         TAILQ_FOREACH(entry, &g_os_sleep_list, t_os_list) {
@@ -210,7 +194,6 @@ os_sched_sleep(struct os_task *t, os_time_t nticks)
         }
     }
 
-exit_sched_sleep:
     os_trace_task_stop_ready(t->t_taskid, OS_TASK_SLEEP);
     return (0);
 }


 

----------------------------------------------------------------
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