RTEMS
threadyield.c
Go to the documentation of this file.
1 
9 /*
10  * Copyright (c) 2014 embedded brains GmbH. All rights reserved.
11  *
12  * embedded brains GmbH
13  * Dornierstr. 4
14  * 82178 Puchheim
15  * Germany
16  * <rtems@embedded-brains.de>
17  *
18  * The license and distribution terms for this file may be
19  * found in the file LICENSE in this distribution or at
20  * http://www.rtems.org/license/LICENSE.
21  */
22 
23 #ifdef HAVE_CONFIG_H
24 #include "config.h"
25 #endif
26 
27 #include <rtems/score/threadimpl.h>
29 
30 void _Thread_Yield( Thread_Control *executing )
31 {
32  ISR_lock_Context lock_context;
33 
34  _Thread_State_acquire( executing, &lock_context );
35 
36  if ( _States_Is_ready( executing->current_state ) ) {
37  _Scheduler_Yield( executing );
38  }
39 
40  _Thread_State_release( executing, &lock_context );
41 }
void _Thread_Yield(Thread_Control *executing)
Yields the currently executing thread.
Definition: threadyield.c:30
Inlined Routines Associated with the Manipulation of the Scheduler.
static __inline__ void _Thread_State_release(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Releases the lock context and enables interrupts.
Definition: threadimpl.h:592
States_Control current_state
Definition: thread.h:749
static __inline__ bool _States_Is_ready(States_Control the_states)
Checks if the state is ready.
Definition: statesimpl.h:195
static __inline__ void _Scheduler_Yield(Thread_Control *the_thread)
Scheduler yield with a particular thread.
Inlined Routines from the Thread Handler.
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:65
static __inline__ void _Thread_State_acquire(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Disables interrupts and acquires the lock_context.
Definition: threadimpl.h:542