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

4.115
Last change on this file since e6f7f81 was 6eba7c85, checked in by Sebastian Huber <sebastian.huber@…>, on 06/10/13 at 14:15:46

scheduler: Specify thread of yield operation

The yielding thread of the yield operation is now specified by a
parameter. The tick operation may be performed for each executing
thread in a SMP configuration.

  • 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.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/system.h>
22#include <rtems/score/isr.h>
23#include <rtems/score/scheduler.h>
24#include <rtems/score/schedulerpriority.h>
25#include <rtems/score/thread.h>
26
27void _Scheduler_priority_Yield( Thread_Control *thread )
28{
29  Scheduler_priority_Per_thread *sched_info;
30  ISR_Level                      level;
31  Chain_Control                 *ready;
32
33  sched_info = (Scheduler_priority_Per_thread *) thread->scheduler_info;
34  ready      = sched_info->ready_chain;
35  _ISR_Disable( level );
36    if ( !_Chain_Has_only_one_node( ready ) ) {
37      _Chain_Extract_unprotected( &thread->Object.Node );
38      _Chain_Append_unprotected( ready, &thread->Object.Node );
39
40      _ISR_Flash( level );
41
42      if ( _Thread_Is_heir( thread ) )
43        _Thread_Heir = (Thread_Control *) _Chain_First( ready );
44      _Thread_Dispatch_necessary = true;
45    }
46    else if ( !_Thread_Is_heir( thread ) )
47      _Thread_Dispatch_necessary = true;
48
49  _ISR_Enable( level );
50}
Note: See TracBrowser for help on using the repository browser.