X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fkern%2Fpreempt.c;h=d3d9badf98f18f688c77f873c91f81aed0ba2818;hb=ae8a609173e4490fd03875f96e388038053b9288;hp=19c43d3c0c01da72d468cf9752faceddf44ad8c5;hpb=32d1445272120a254d77ce8d1af1f527da7a2c17;p=bertos.git diff --git a/bertos/kern/preempt.c b/bertos/kern/preempt.c index 19c43d3c..d3d9badf 100644 --- a/bertos/kern/preempt.c +++ b/bertos/kern/preempt.c @@ -39,7 +39,7 @@ * the time sharing interval. * * When the quantum expires the handler proc_needPreempt() checks if the - * preemption is enabled and in this case proc_schedule() is called, that + * preemption is enabled and in this case preempt_schedule() is called, that * possibly replaces the current running thread with a different one. * * The preemption can be disabled or enabled via proc_forbid() and @@ -126,7 +126,7 @@ int _proc_quantum; /** * Call the scheduler and eventually replace the current running process. */ -static void proc_schedule(void) +static void preempt_schedule(void) { Process *old_process = current_process; @@ -166,7 +166,7 @@ static void proc_schedule(void) /** * Check if we need to schedule another task */ -int proc_needPreempt(void) +int preempt_needPreempt(void) { if (UNLIKELY(current_process == NULL)) return 0; @@ -179,7 +179,7 @@ int proc_needPreempt(void) /** * Preempt the current task. */ -void proc_preempt(void) +void preempt_preempt(void) { IRQ_ASSERT_DISABLED(); ASSERT(current_process); @@ -189,7 +189,7 @@ void proc_preempt(void) /* We are inside a IRQ context, so ATOMIC is not needed here */ if (current_process != idle_proc) SCHED_ENQUEUE(current_process); - proc_schedule(); + preempt_schedule(); } /** @@ -200,17 +200,18 @@ void proc_preempt(void) * \warning This should be considered an internal kernel function, even if it * is allowed, usage from application code is strongly discouraged. */ -void proc_switch(void) +void preempt_switch(void) { ASSERT(proc_preemptAllowed()); + IRQ_ASSERT_ENABLED(); - ATOMIC(proc_schedule()); + ATOMIC(preempt_schedule()); } /** * Voluntarily release the CPU. */ -void proc_yield(void) +void preempt_yield(void) { /* * Voluntary preemption while preemption is disabled is considered @@ -219,10 +220,11 @@ void proc_yield(void) * ASSERT if it happens. */ ASSERT(proc_preemptAllowed()); + IRQ_ASSERT_ENABLED(); ATOMIC( SCHED_ENQUEUE(current_process); - proc_schedule(); + preempt_schedule(); ); }