[haiku-commits] r41924 - in haiku/branches/developer/bonefish/signals: headers/private/kernel src/system/kernel/scheduler

Author: bonefish
Date: 2011-06-05 02:34:03 +0200 (Sun, 05 Jun 2011)
New Revision: 41924
Changeset: https://dev.haiku-os.org/changeset/41924

Modified:
   haiku/branches/developer/bonefish/signals/headers/private/kernel/kscheduler.h
   
haiku/branches/developer/bonefish/signals/src/system/kernel/scheduler/scheduler.cpp
   
haiku/branches/developer/bonefish/signals/src/system/kernel/scheduler/scheduler_affine.cpp
   
haiku/branches/developer/bonefish/signals/src/system/kernel/scheduler/scheduler_simple.cpp
   
haiku/branches/developer/bonefish/signals/src/system/kernel/scheduler/scheduler_simple_smp.cpp
Log:
Moved scheduler_switch_thread() to new header scheduler_common.h, included only
by the scheduler implementations, and declared it inline.


Modified: 
haiku/branches/developer/bonefish/signals/headers/private/kernel/kscheduler.h
===================================================================
--- 
haiku/branches/developer/bonefish/signals/headers/private/kernel/kscheduler.h   
    2011-06-05 00:30:33 UTC (rev 41923)
+++ 
haiku/branches/developer/bonefish/signals/headers/private/kernel/kscheduler.h   
    2011-06-05 00:34:03 UTC (rev 41924)
@@ -89,8 +89,6 @@
 extern "C" {
 #endif
 
-void scheduler_switch_thread(Thread* fromThread, Thread* toThread);
-
 void scheduler_add_listener(struct SchedulerListener* listener);
 void scheduler_remove_listener(struct SchedulerListener* listener);
 

Modified: 
haiku/branches/developer/bonefish/signals/src/system/kernel/scheduler/scheduler.cpp
===================================================================
--- 
haiku/branches/developer/bonefish/signals/src/system/kernel/scheduler/scheduler.cpp
 2011-06-05 00:30:33 UTC (rev 41923)
+++ 
haiku/branches/developer/bonefish/signals/src/system/kernel/scheduler/scheduler.cpp
 2011-06-05 00:34:03 UTC (rev 41924)
@@ -42,52 +42,6 @@
 // #pragma mark - kernel private
 
 
-/*!    Switches the currently running thread.
-       This is a service function for scheduler implementations.
-
-       \param fromThread The currently running thread.
-       \param toThread The thread to switch to. Must be different from
-               \a fromThread.
-*/
-void
-scheduler_switch_thread(Thread* fromThread, Thread* toThread)
-{
-       // notify the user debugger code
-       if ((fromThread->flags & THREAD_FLAGS_DEBUGGER_INSTALLED) != 0)
-               user_debug_thread_unscheduled(fromThread);
-
-       // stop CPU time based user timers
-       if (fromThread->HasActiveCPUTimeUserTimers()
-               || fromThread->team->HasActiveCPUTimeUserTimers()) {
-               user_timer_stop_cpu_timers(fromThread, toThread);
-       }
-
-       // update CPU and Thread structures and perform the context switch
-       cpu_ent* cpu = fromThread->cpu;
-       toThread->previous_cpu = toThread->cpu = cpu;
-       fromThread->cpu = NULL;
-       cpu->running_thread = toThread;
-       cpu->previous_thread = fromThread;
-
-       arch_thread_set_current_thread(toThread);
-       arch_thread_context_switch(fromThread, toThread);
-
-       // The use of fromThread below looks weird, but is correct. fromThread 
had
-       // been unscheduled earlier, but is back now. For a thread scheduled the
-       // first time the same is done in thread.cpp:common_thread_entry().
-
-       // continue CPU time based user timers
-       if (fromThread->HasActiveCPUTimeUserTimers()
-               || fromThread->team->HasActiveCPUTimeUserTimers()) {
-               user_timer_continue_cpu_timers(fromThread, 
cpu->previous_thread);
-       }
-
-       // notify the user debugger code
-       if ((fromThread->flags & THREAD_FLAGS_DEBUGGER_INSTALLED) != 0)
-               user_debug_thread_scheduled(fromThread);
-}
-
-
 /*!    Add the given scheduler listener. Thread lock must be held.
 */
 void

Modified: 
haiku/branches/developer/bonefish/signals/src/system/kernel/scheduler/scheduler_affine.cpp
===================================================================
--- 
haiku/branches/developer/bonefish/signals/src/system/kernel/scheduler/scheduler_affine.cpp
  2011-06-05 00:30:33 UTC (rev 41923)
+++ 
haiku/branches/developer/bonefish/signals/src/system/kernel/scheduler/scheduler_affine.cpp
  2011-06-05 00:34:03 UTC (rev 41924)
@@ -25,8 +25,8 @@
 #include <smp.h>
 #include <thread.h>
 #include <timer.h>
-#include <user_debugger.h>
 
+#include "scheduler_common.h"
 #include "scheduler_tracing.h"
 
 

Modified: 
haiku/branches/developer/bonefish/signals/src/system/kernel/scheduler/scheduler_simple.cpp
===================================================================
--- 
haiku/branches/developer/bonefish/signals/src/system/kernel/scheduler/scheduler_simple.cpp
  2011-06-05 00:30:33 UTC (rev 41923)
+++ 
haiku/branches/developer/bonefish/signals/src/system/kernel/scheduler/scheduler_simple.cpp
  2011-06-05 00:34:03 UTC (rev 41924)
@@ -23,8 +23,8 @@
 #include <scheduler_defs.h>
 #include <thread.h>
 #include <timer.h>
-#include <user_debugger.h>
 
+#include "scheduler_common.h"
 #include "scheduler_tracing.h"
 
 

Modified: 
haiku/branches/developer/bonefish/signals/src/system/kernel/scheduler/scheduler_simple_smp.cpp
===================================================================
--- 
haiku/branches/developer/bonefish/signals/src/system/kernel/scheduler/scheduler_simple_smp.cpp
      2011-06-05 00:30:33 UTC (rev 41923)
+++ 
haiku/branches/developer/bonefish/signals/src/system/kernel/scheduler/scheduler_simple_smp.cpp
      2011-06-05 00:34:03 UTC (rev 41924)
@@ -24,8 +24,8 @@
 #include <smp.h>
 #include <thread.h>
 #include <timer.h>
-#include <user_debugger.h>
 
+#include "scheduler_common.h"
 #include "scheduler_tracing.h"
 
 


Other related posts:

  • » [haiku-commits] r41924 - in haiku/branches/developer/bonefish/signals: headers/private/kernel src/system/kernel/scheduler - ingo_weinhold