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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [tests/] [mptests/] [mp10/] [task3.c] - Blame information for rev 173

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*  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: task3.c,v 1.2 2001-09-27 12:02:21 chris 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.