source: rtems/testsuites/mptests/mp10/task3.c @ 08311cc3

4.104.114.84.95
Last change on this file since 08311cc3 was 08311cc3, checked in by Joel Sherrill <joel.sherrill@…>, on 11/17/99 at 17:51:34

Updated copyright notice.

  • 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.OARcorp.com/rtems/license.html.
16 *
17 *  $Id$
18 */
19
20#include "system.h"
21
22rtems_task Test_task3( restart )
23rtems_task_argument restart;
24{
25  rtems_status_code status;
26
27  if ( restart == 1 ) {
28    status = rtems_task_delete( RTEMS_SELF );
29    directive_failed( status, "rtems_task_delete" );
30  }
31
32  puts( "Getting SMID of semaphore" );
33
34  do {
35    status = rtems_semaphore_ident(
36      Semaphore_name[ 1 ],
37      RTEMS_SEARCH_ALL_NODES,
38      &Semaphore_id[ 1 ]
39    );
40  } while ( !rtems_is_status_successful( status ) );
41
42  puts( "Attempting to acquire semaphore ..." );
43  status = rtems_semaphore_obtain(
44    Semaphore_id[ 1 ],
45    RTEMS_DEFAULT_OPTIONS,
46    RTEMS_NO_TIMEOUT
47  );
48  directive_failed( status, "rtems_semaphore_obtain" );
49}
Note: See TracBrowser for help on using the repository browser.