4.104.114.84.95
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 | |
---|
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 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.