[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tyndur-devel] [PATCH] kernel2: Fix fuer pm_scheduler_delete



! kernel2: Wenn man in einer Liste ein Element sucht, sollte man auch
  gelegentlich die Laufvariable erhöhen. Ansonsten kann man da ziemlich
  lang suchen, wenn es nicht das erste Element ist.

Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
---
 src/kernel2/src/tasks/scheduler.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/kernel2/src/tasks/scheduler.c b/src/kernel2/src/tasks/scheduler.c
index 1556999..975412a 100644
--- a/src/kernel2/src/tasks/scheduler.c
+++ b/src/kernel2/src/tasks/scheduler.c
@@ -86,14 +86,14 @@ void pm_scheduler_add(pm_thread_t* thread)
  */
 void pm_scheduler_delete(pm_thread_t* thread)
 {
-    int i = 0;
-    pm_thread_t* thread_;
-    
+    int i;
+    pm_thread_t* p;
+
     lock(&scheduler_lock);
 
     // Die Liste mit den Threads durchsuchen
-    while ((thread_ = list_get_element_at(threads_available, i))) {
-        if (thread_ == thread) {
+    for (i = 0; (p = list_get_element_at(threads_available, i)); i++) {
+        if (p == thread) {
             list_remove(threads_available, i);
             break;
         }
-- 
1.6.0.2