source: rtems/testsuites/sptests/sp12/task5.c

Last change on this file was 6c0301d, checked in by Sebastian Huber <sebastian.huber@…>, on Mar 25, 2014 at 7:06:21 AM

tests/sptests: Use <rtems/test.h>

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*  Task5
2 *
3 *  This routine serves as a test task.  It obtains semaphore 1 correctly
4 *  once, then waits for semaphore 1 again.  Task 1 should delete the
5 *  semaphore, thus waking this task up.
6 *
7 *  Input parameters:
8 *    argument - task argument
9 *
10 *  Output parameters:  NONE
11 *
12 *  COPYRIGHT (c) 1989-1999.
13 *  On-Line Applications Research Corporation (OAR).
14 *
15 *  The license and distribution terms for this file may be
16 *  found in the file LICENSE in this distribution or at
17 *  http://www.rtems.org/license/LICENSE.
18 */
19
20#ifdef HAVE_CONFIG_H
21#include "config.h"
22#endif
23
24#include "system.h"
25
26rtems_task Task5(
27  rtems_task_argument argument
28)
29{
30  rtems_status_code status;
31
32  puts( "TA5 - rtems_semaphore_obtain - wait forever on SM1" );
33  status = rtems_semaphore_obtain(
34    Semaphore_id[ 1 ],
35    RTEMS_DEFAULT_OPTIONS,
36    RTEMS_NO_TIMEOUT
37  );
38  directive_failed( status, "rtems_semaphore_obtain on SM1" );
39  puts( "TA5 - got SM1" );
40
41  puts( "TA5 - rtems_semaphore_obtain - wait forever on SM1" );
42  status = rtems_semaphore_obtain(
43    Semaphore_id[ 1 ],
44    RTEMS_DEFAULT_OPTIONS,
45    RTEMS_NO_TIMEOUT
46  );
47  fatal_directive_status(
48    status,
49    RTEMS_OBJECT_WAS_DELETED,
50    "rtems_semaphore_obtain on SM1"
51  );
52  puts( "TA5 - SM1 deleted by TA1" );
53
54  TEST_END();
55  rtems_test_exit( 0 );
56}
Note: See TracBrowser for help on using the repository browser.