source: rtems/cpukit/itron/src/chg_pri.c @ 9d2df2b3

4.104.115
Last change on this file since 9d2df2b3 was 9d2df2b3, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/03/09 at 05:23:05

Eliminate TRUE/FALSE in favor of true/false.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2007.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <rtems/itron.h>
17
18#include <rtems/score/thread.h>
19#include <rtems/score/userext.h>
20#include <rtems/score/wkspace.h>
21#include <rtems/score/apiext.h>
22#include <rtems/score/sysstate.h>
23
24#include <rtems/itron/task.h>
25
26/*
27 *  chg_pri - Change Task Priority
28 */
29
30ER chg_pri(
31  ID  tskid,
32  PRI tskpri
33)
34{
35  register Thread_Control *the_thread;
36  Objects_Locations        location;
37  Priority_Control         new_priority;
38
39  the_thread = _ITRON_Task_Get( tskid, &location );
40  switch ( location ) {
41#if defined(RTEMS_MULTIPROCESSING)
42    case OBJECTS_REMOTE:
43#endif
44    case OBJECTS_ERROR:
45      return _ITRON_Task_Clarify_get_id_error( tskid );
46
47    case OBJECTS_LOCAL:
48      if (_States_Is_dormant( the_thread->current_state ))
49        _ITRON_return_errorno( E_OBJ );
50
51      if (( tskpri <= 0 ) || ( tskpri >= PRIORITY_MAXIMUM-1 ))
52        _ITRON_return_errorno( E_PAR );
53
54      new_priority = _ITRON_Task_Priority_to_Core( tskpri );
55      the_thread->real_priority = new_priority;
56
57      /*
58       * The priority should not be changed until later if priority
59       * inheratance has occured.
60       */
61
62      if ( the_thread->resource_count == 0 ||
63           the_thread->current_priority > new_priority )
64        _Thread_Change_priority( the_thread, new_priority, false );
65
66      break;
67  }
68
69  _ITRON_return_errorno( E_OK );
70}
Note: See TracBrowser for help on using the repository browser.