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

Last change on this file was c499856, checked in by Chris Johns <chrisj@…>, on Mar 20, 2014 at 9:10:47 PM

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

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