Add scheduling notifications to scheduler_affine.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32463 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2009-08-17 14:51:07 +00:00
parent 31a36e3021
commit 699bf40942

View File

@ -18,6 +18,7 @@
#include <int.h>
#include <kernel.h>
#include <kscheduler.h>
#include <listeners.h>
#include <scheduler_defs.h>
#include <smp.h>
#include <thread.h>
@ -199,6 +200,10 @@ affine_enqueue_in_run_queue(struct thread *thread)
smp_send_ici(idleCPU, SMP_MSG_RESCHEDULE_IF_IDLE, 0, 0,
0, NULL, SMP_MSG_FLAG_ASYNC);
}
// notify listeners
NotifySchedulerListeners(&SchedulerListener::ThreadEnqueuedInRunQueue,
thread);
}
static inline struct thread *
@ -295,6 +300,10 @@ affine_set_thread_priority(struct thread *thread, int32 priority)
T(RemoveThread(thread));
// notify listeners
NotifySchedulerListeners(&SchedulerListener::ThreadRemovedFromRunQueue,
thread);
// search run queues for the thread
// TODO: keep track of the queue a thread is in (perhaps in a
// data pointer on the thread struct) so we only have to walk
@ -436,6 +445,10 @@ affine_reschedule(void)
T(ScheduleThread(nextThread, oldThread));
// notify listeners
NotifySchedulerListeners(&SchedulerListener::ThreadScheduled,
oldThread, nextThread);
nextThread->state = B_THREAD_RUNNING;
nextThread->next_state = B_THREAD_READY;
oldThread->was_yielded = false;