Mercurial > nand-ecoscentric
changeset 2117:5d7f57fd1729
* src/sched/sched.cxx:
* include/sched.hxx (class Cyg_Scheduler): Added thread_entry()
member function. This handles thread startup housekeeping. Zeroing
the scheduler lock is handled by calling unlock() so that DSRs may
be run.
* src/common/thread.cxx (thread_entry): Refactored code to call
Cyg_Scheduler::thread_entry() instead of doing all the work here.
| author | nickg |
|---|---|
| date | Tue, 10 Jan 2006 15:52:54 +0000 |
| parents | 8286f0e1f4c7 |
| children | ced9249cc916 |
| files | packages/kernel/current/ChangeLog packages/kernel/current/include/sched.hxx packages/kernel/current/src/common/thread.cxx packages/kernel/current/src/sched/sched.cxx |
| diffstat | 4 files changed, 40 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/kernel/current/ChangeLog +++ b/packages/kernel/current/ChangeLog @@ -1,3 +1,14 @@ +2006-01-10 Nick Garnett <nickg@ecoscentric.com> + + * src/sched/sched.cxx: + * include/sched.hxx (class Cyg_Scheduler): Added thread_entry() + member function. This handles thread startup housekeeping. Zeroing + the scheduler lock is handled by calling unlock() so that DSRs may + be run. + + * src/common/thread.cxx (thread_entry): Refactored code to call + Cyg_Scheduler::thread_entry() instead of doing all the work here. + 2005-11-23 Sergei Organov <osv@javad.com> * doc/kernel.sgml: Fix description of CYG_ISR_CALL_DSR and
--- a/packages/kernel/current/include/sched.hxx +++ b/packages/kernel/current/include/sched.hxx @@ -176,6 +176,9 @@ public: // release the preemption lock without rescheduling static void unlock_simple(); + + // perform thread startup housekeeping + void Cyg_Scheduler::thread_entry( Cyg_Thread *thread ); // Start execution of the scheduler static void start() CYGBLD_ATTRIB_NORET;
--- a/packages/kernel/current/src/common/thread.cxx +++ b/packages/kernel/current/src/common/thread.cxx @@ -86,24 +86,10 @@ Cyg_HardwareThread::thread_entry( Cyg_Th { CYG_REPORT_FUNCTION(); - Cyg_Scheduler::scheduler.clear_need_reschedule(); // finished rescheduling - Cyg_Scheduler::scheduler.set_current_thread(thread); // restore current thread pointer - - CYG_INSTRUMENT_THREAD(ENTER,thread,0); + // Call the scheduler to do any housekeeping + Cyg_Scheduler::scheduler.thread_entry( thread ); -#ifdef CYGSEM_KERNEL_SCHED_TIMESLICE - // Reset the timeslice counter so that this thread gets a full - // quantum. - Cyg_Scheduler::reset_timeslice_count(); -#endif - - // Zero the lock - HAL_REORDER_BARRIER (); // Prevent the compiler from moving - Cyg_Scheduler::zero_sched_lock(); // the assignment into the code above. - HAL_REORDER_BARRIER(); - // Call entry point in a loop. - for(;;) { thread->entry_point(thread->entry_data); @@ -1225,11 +1211,11 @@ Cyg_ThreadTimer::alarm( # endif // CYGNUM_KERNEL_THREADS_IDLE_STACK_SIZE #endif // CYGNUM_HAL_STACK_SIZE_MINIMUM -static char idle_thread_stack[CYGNUM_KERNEL_CPU_MAX][CYGNUM_KERNEL_THREADS_IDLE_STACK_SIZE]; - // Loop counter for debugging/housekeeping cyg_uint32 idle_thread_loops[CYGNUM_KERNEL_CPU_MAX]; +static char idle_thread_stack[CYGNUM_KERNEL_CPU_MAX][CYGNUM_KERNEL_THREADS_IDLE_STACK_SIZE]; + // ------------------------------------------------------------------------- // Idle thread code.
--- a/packages/kernel/current/src/sched/sched.cxx +++ b/packages/kernel/current/src/sched/sched.cxx @@ -309,6 +309,28 @@ void Cyg_Scheduler::unlock_inner( cyg_uc } // ------------------------------------------------------------------------- +// Thread startup. This is called from Cyg_Thread::thread_entry() and +// performs some housekeeping for a newly started thread. + +void Cyg_Scheduler::thread_entry( Cyg_Thread *thread ) +{ + clear_need_reschedule(); // finished rescheduling + set_current_thread(thread); // restore current thread pointer + + CYG_INSTRUMENT_THREAD(ENTER,thread,0); + +#ifdef CYGSEM_KERNEL_SCHED_TIMESLICE + // Reset the timeslice counter so that this thread gets a full + // quantum. + reset_timeslice_count(); +#endif + + // Finally unlock the scheduler. As well as clearing the scheduler + // lock this allows any pending DSRs to execute. + unlock(); +} + +// ------------------------------------------------------------------------- // Start the scheduler. This is called after the initial threads have been // created to start scheduling. It gets any other CPUs running, and then // enters the scheduler.
