source: rtems/testsuites/mptests/mp10/task3.c @ bb3484c9

5
Last change on this file since bb3484c9 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.1 KB
Line 
1/*  Test_task3
2 *
3 *  This task attempts to receive control of a global semaphore.
4 *  It should never receive control of the semaphore.
5 *
6 *  Input parameters:  NONE
7 *
8 *  Output parameters:  NONE
9 *
10 *  COPYRIGHT (c) 1989-1999.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.org/license/LICENSE.
16 */
17
18#ifdef HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include "system.h"
23
24rtems_task Test_task3( restart )
25rtems_task_argument restart;
26{
27  rtems_status_code status;
28
29  if ( restart == 1 ) {
30    rtems_task_exit();
31  }
32
33  puts( "Getting SMID of semaphore" );
34
35  do {
36    status = rtems_semaphore_ident(
37      Semaphore_name[ 1 ],
38      RTEMS_SEARCH_ALL_NODES,
39      &Semaphore_id[ 1 ]
40    );
41  } while ( !rtems_is_status_successful( status ) );
42
43  puts( "Attempting to acquire semaphore ..." );
44  status = rtems_semaphore_obtain(
45    Semaphore_id[ 1 ],
46    RTEMS_DEFAULT_OPTIONS,
47    RTEMS_NO_TIMEOUT
48  );
49  directive_failed( status, "rtems_semaphore_obtain" );
50}
Note: See TracBrowser for help on using the repository browser.