source: rtems/cpukit/score/src/schedulerpriorityyield.c @ c499856

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief Scheduler Priority Yield
5 *  @ingroup ScoreScheduler
6 */
7
8/*
9 *  Copyright (C) 2010 Gedare Bloom.
10 *  Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/score/schedulerpriorityimpl.h>
22#include <rtems/score/isr.h>
23#include <rtems/score/threadimpl.h>
24
25void _Scheduler_priority_Yield( Thread_Control *thread )
26{
27  Scheduler_priority_Per_thread *sched_info_of_thread =
28    _Scheduler_priority_Get_scheduler_info( thread );
29  Chain_Control *ready_chain = sched_info_of_thread->ready_chain;
30  ISR_Level level;
31
32  _ISR_Disable( level );
33    if ( !_Chain_Has_only_one_node( ready_chain ) ) {
34      _Chain_Extract_unprotected( &thread->Object.Node );
35      _Chain_Append_unprotected( ready_chain, &thread->Object.Node );
36
37      _ISR_Flash( level );
38
39      if ( _Thread_Is_heir( thread ) )
40        _Thread_Heir = (Thread_Control *) _Chain_First( ready_chain );
41      _Thread_Dispatch_necessary = true;
42    }
43    else if ( !_Thread_Is_heir( thread ) )
44      _Thread_Dispatch_necessary = true;
45
46  _ISR_Enable( level );
47}
Note: See TracBrowser for help on using the repository browser.