source: rtems/testsuites/sptests/sp07/task1.c @ 51b3cbca

5
Last change on this file since 51b3cbca was 51b3cbca, checked in by Sebastian Huber <sebastian.huber@…>, on 10/04/18 at 13:23:25

tests: Use rtems_task_exit()

Update #3533.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2011.
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.org/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include "system.h"
15
16rtems_task Task_1(
17  rtems_task_argument argument
18)
19{
20  rtems_status_code   status;
21  rtems_task_priority the_priority;
22  rtems_task_priority previous_priority;
23
24  rtems_test_pause();
25
26  status = rtems_task_set_priority(
27    RTEMS_SELF,
28    RTEMS_CURRENT_PRIORITY,
29    &the_priority
30  );
31  directive_failed( status, "rtems_task_set_priority" );
32  printf(
33    "TA1 - rtems_task_set_priority - get initial "
34       "priority of self: %02" PRIdrtems_task_priority "\n",
35    the_priority
36  );
37
38  while( FOREVER ) {
39    if ( --the_priority == 0 ) {
40      puts( "TA1 - rtems_task_suspend - suspend TA2" );
41      status = rtems_task_suspend( Task_id[ 2 ] );
42      directive_failed( status, "rtems_task_suspend" );
43
44      puts( "TA1 - rtems_task_set_priority - set priority of TA2 ( blocked )" );
45      status = rtems_task_set_priority( Task_id[ 2 ], 5, &previous_priority );
46      directive_failed( status, "rtems_task_set_priority" );
47
48      status = rtems_task_delete( Task_id[ 2 ] );
49      directive_failed( status, "rtems_task_delete of TA2" );
50
51      rtems_task_exit();
52    }
53
54    printf(
55      "TA1 - rtems_task_set_priority - set TA2's priority: "
56          "%02" PRIdrtems_task_priority "\n",
57      the_priority
58    );
59    status = rtems_task_set_priority(
60               Task_id[ 2 ],
61               the_priority,
62               &previous_priority
63    );
64    directive_failed( status, "rtems_task_set_priority" );
65  }
66}
Note: See TracBrowser for help on using the repository browser.