This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Round robin scheduler question


> So any clues as to what I have to change for option 2?

I think i would try something like:

mlqueue.c: function schedule(void) At the end

#else    
 
    register cyg_uint32 index;
 
    HAL_LSBIT_INDEX(index, queue_map);
 
    Cyg_RunQueue *queue = &run_queue[index];
    
    CYG_ASSERT( !queue->empty(), "Queue for index empty");
 
    Cyg_Thread *thread = queue->get_head();

+    if ( thread != current) {
+            cyg_priority pri    = current->priority;
+            Cyg_Scheduler *sched = &Cyg_Scheduler::scheduler;
+            Cyg_RunQueue *current_queue = &sched->run_queue[pri];
+            current_queue->rotate();
+    }

#endif

This is totally untested. Make sure you turn on asserts and expect it
to go horribly wrong!

   Andrew

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]