00001 /* header file for src/thread/scheduler.cpp */ 00002 00003 #ifndef _CORE_THREAD_SCHEDULER_HPP 00004 #define _CORE_THREAD_SCHEDULER_HPP 00005 00006 //necessary includes 00007 #include "src/ipc/lock.hpp" 00008 #include "src/common/blist.hpp" 00009 #include "src/thread/thread.hpp" 00010 00015 #define DISABLE_FAST_MOVING_CHARS 1 00016 //#define DISABLE_FAST_MOVING_CHARS 0 00017 00019 // extern "C" void schedule() __attribute__ ((noreturn)); //the function executed from the stub 00020 //arch::x86 00021 00022 extern volatile Thread::thread_t *current_thread; 00023 00024 const uint32 PRIOR_THREAD_DELTA = 4; 00025 const uint32 PRIOR_THREAD_SLEEP = 15; 00026 00027 namespace Thread { 00028 00029 void init(); /*init multitasking*/ 00030 extern struct thread_t *MemsetThreadHandle; 00031 00032 namespace Scheduler { 00033 00034 /* general */ 00035 const uint32 SCHEDULER_FREQUENCY = 2048; //in Hz 00036 00037 extern bool volatile multitasking_running; //whether we made the first switch 00038 extern class IPC::Lock::lock_t lock_scheduler; 00039 // extern uint64 volatile last_queue_refill; //the last time the thread_queues needed to be refilled with threads_ran 00040 // 00041 // int add_thread(thread_t *thread, uint32 queue); //add a thread to the queues 00042 // int remove_thread(thread_t *thread); //remove a thread from the queues 00043 // int unqueue_thread(thread_t *thread, blist_t *src, blist_t *dest, void **data); //move to other queue 00044 extern "C" int choose_next_thread(); //choose a new thread to be ran 00045 // 00046 00047 extern volatile uint32 time_slices; 00048 00049 }; /*namespace Scheduler*/ 00050 00051 00052 }; /*namespace Thread*/ 00053 00054 #endif