OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [c/] [src/] [tests/] [mptests/] [mp10/] [task3.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*  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
 *  task3.c,v 1.7 1999/11/17 17:51:30 joel Exp
18
 */
19
 
20
#include "system.h"
21
 
22
rtems_task Test_task3( restart )
23
rtems_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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.