Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 93ac114

Browse files
committedOct 27, 2014
core: move thread_yield*() to thread.[ch]
Although it might conceptionally rather belong to the scheduler, the yield functions are prefixed with thread_ and thus, belong there.
1 parent 6f53cd4 commit 93ac114

File tree

4 files changed

+26
-26
lines changed

4 files changed

+26
-26
lines changed
 

‎core/include/sched.h

-14
Original file line numberDiff line numberDiff line change
@@ -157,20 +157,6 @@ extern volatile kernel_pid_t sched_active_pid;
157157
*/
158158
extern clist_node_t *sched_runqueues[SCHED_PRIO_LEVELS];
159159

160-
/**
161-
* @brief Lets current thread yield in favor of a higher prioritized thread.
162-
*
163-
* @details The current thread will resume operation immediately,
164-
* if there is no other ready thread with a higher priority.
165-
*
166-
* Differently from thread_yield() the current thread will be scheduled next
167-
* in its own priority class, i.e. it stays the first thread in its
168-
* priority class.
169-
*
170-
* @see thread_yield()
171-
*/
172-
void thread_yield_higher(void);
173-
174160
#if SCHEDSTATISTICS
175161
/**
176162
* Scheduler statistics

‎core/include/thread.h

+14
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,20 @@ void thread_sleep(void);
134134
*/
135135
void thread_yield(void);
136136

137+
/**
138+
* @brief Lets current thread yield in favor of a higher prioritized thread.
139+
*
140+
* @details The current thread will resume operation immediately,
141+
* if there is no other ready thread with a higher priority.
142+
*
143+
* Differently from thread_yield() the current thread will be scheduled next
144+
* in its own priority class, i.e. it stays the first thread in its
145+
* priority class.
146+
*
147+
* @see thread_yield()
148+
*/
149+
void thread_yield_higher(void);
150+
137151
/**
138152
* @brief Wakes up a sleeping thread.
139153
*

‎core/sched.c

-12
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,3 @@ NORETURN void sched_task_exit(void)
179179
sched_active_thread = NULL;
180180
cpu_switch_context_exit();
181181
}
182-
183-
void thread_yield(void)
184-
{
185-
unsigned old_state = disableIRQ();
186-
tcb_t *me = (tcb_t *)sched_active_thread;
187-
if (me->status >= STATUS_ON_RUNQUEUE) {
188-
clist_advance(&sched_runqueues[me->priority]);
189-
}
190-
restoreIRQ(old_state);
191-
192-
thread_yield_higher();
193-
}

‎core/thread.c

+12
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,18 @@ int thread_wakeup(kernel_pid_t pid)
8989
}
9090
}
9191

92+
void thread_yield(void)
93+
{
94+
unsigned old_state = disableIRQ();
95+
tcb_t *me = (tcb_t *)sched_active_thread;
96+
if (me->status >= STATUS_ON_RUNQUEUE) {
97+
clist_advance(&sched_runqueues[me->priority]);
98+
}
99+
restoreIRQ(old_state);
100+
101+
thread_yield_higher();
102+
}
103+
92104
#ifdef DEVELHELP
93105
uintptr_t thread_measure_stack_free(char *stack)
94106
{

0 commit comments

Comments
 (0)
Please sign in to comment.