summaryrefslogtreecommitdiff
path: root/src/scheduler.c
diff options
context:
space:
mode:
authorshaojinchun <[email protected]>2019-11-05 08:41:38 +0800
committershaojinchun <[email protected]>2019-11-05 08:41:38 +0800
commite03ac83ad3d22c578e367550d2ff714b53e79799 (patch)
tree5330284b0bd13a61d0c09dd511a4124dc2b5e8ad /src/scheduler.c
parent9a38bba1689ff1e73500584023051cced977a5c5 (diff)
将yield状态置于tcb的stat位域中
Diffstat (limited to 'src/scheduler.c')
-rw-r--r--src/scheduler.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/scheduler.c b/src/scheduler.c
index c58ecf6209..edcf11dba5 100644
--- a/src/scheduler.c
+++ b/src/scheduler.c
@@ -344,13 +344,13 @@ void rt_schedule(void)
{
to_thread = current_thread;
}
- else if (current_thread->current_priority == highest_ready_priority && current_thread->can_yield == RT_FALSE)
+ else if (current_thread->current_priority == highest_ready_priority && (current_thread->stat & RT_THREAD_STAT_YIELD_MASK) == 0)
{
to_thread = current_thread;
}
else
{
- current_thread->can_yield = RT_FALSE;
+ current_thread->stat &= ~RT_THREAD_STAT_YIELD_MASK;
rt_schedule_insert_thread(current_thread);
}
}
@@ -440,13 +440,13 @@ void rt_schedule(void)
{
to_thread = rt_current_thread;
}
- else if (rt_current_thread->current_priority == highest_ready_priority && rt_current_thread->can_yield == RT_FALSE)
+ else if (rt_current_thread->current_priority == highest_ready_priority && (rt_current_thread->stat & RT_THREAD_STAT_YIELD_MASK) == 0)
{
to_thread = rt_current_thread;
}
else
{
- rt_current_thread->can_yield = RT_FALSE;
+ rt_current_thread->stat &= ~RT_THREAD_STAT_YIELD_MASK;
need_insert_from_thread = 1;
}
}
@@ -588,13 +588,13 @@ void rt_scheduler_do_irq_switch(void *context)
{
to_thread = current_thread;
}
- else if (current_thread->current_priority == highest_ready_priority && current_thread->can_yield == RT_FALSE)
+ else if (current_thread->current_priority == highest_ready_priority && (current_thread->stat & RT_THREAD_STAT_YIELD_MASK) == 0)
{
to_thread = current_thread;
}
else
{
- current_thread->can_yield = RT_FALSE;
+ current_thread->stat &= ~RT_THREAD_STAT_YIELD_MASK;
rt_schedule_insert_thread(current_thread);
}
}