5
Last change
on this file since 9a4eca5 was
c499856,
checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47
|
Change all references of rtems.com to rtems.org.
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[e3515731] | 1 | /* Task_1 |
---|
[c6d15c2] | 2 | * |
---|
| 3 | * This routine serves as a test task. It verifies the basic task |
---|
| 4 | * switching capabilities of the executive. |
---|
| 5 | * |
---|
| 6 | * Input parameters: |
---|
| 7 | * argument - task argument |
---|
| 8 | * |
---|
| 9 | * Output parameters: NONE |
---|
| 10 | * |
---|
[2317457] | 11 | * COPYRIGHT (c) 1989-2009. |
---|
[c6d15c2] | 12 | * On-Line Applications Research Corporation (OAR). |
---|
| 13 | * |
---|
[98e4ebf5] | 14 | * The license and distribution terms for this file may be |
---|
| 15 | * found in the file LICENSE in this distribution or at |
---|
[c499856] | 16 | * http://www.rtems.org/license/LICENSE. |
---|
[c6d15c2] | 17 | */ |
---|
| 18 | |
---|
[cafefbf] | 19 | #ifdef HAVE_CONFIG_H |
---|
| 20 | #include "config.h" |
---|
| 21 | #endif |
---|
| 22 | |
---|
[c6d15c2] | 23 | #include "system.h" |
---|
| 24 | #include <errno.h> |
---|
| 25 | |
---|
[e3515731] | 26 | void *Task_1( |
---|
[c6d15c2] | 27 | void *argument |
---|
| 28 | ) |
---|
| 29 | { |
---|
| 30 | int status; |
---|
| 31 | |
---|
| 32 | printf( "Task: pthread_mutex_trylock already locked\n" ); |
---|
| 33 | status = pthread_mutex_trylock( &Mutex_id ); |
---|
| 34 | if ( status != EBUSY ) |
---|
| 35 | printf( "status = %d\n", status ); |
---|
[33c46f1] | 36 | rtems_test_assert( status == EBUSY ); |
---|
[c6d15c2] | 37 | |
---|
| 38 | printf( "Task: pthread_mutex_lock unavailable\n" ); |
---|
| 39 | status = pthread_mutex_lock( &Mutex_id ); |
---|
| 40 | if ( status ) |
---|
| 41 | printf( "status = %d\n", status ); |
---|
[33c46f1] | 42 | rtems_test_assert( !status ); |
---|
[c6d15c2] | 43 | |
---|
[ce78b894] | 44 | /* switch to init */ |
---|
| 45 | |
---|
[c6d15c2] | 46 | printf( "Task: mutex acquired\n" ); |
---|
| 47 | |
---|
[ce78b894] | 48 | printf( "Task: sleep for 2 seconds\n" ); |
---|
| 49 | sleep( 2 ); |
---|
| 50 | |
---|
| 51 | /* switch to init */ |
---|
[c6d15c2] | 52 | |
---|
| 53 | printf( "Task: exit\n" ); |
---|
| 54 | pthread_exit( NULL ); |
---|
| 55 | |
---|
| 56 | /* switch to Init */ |
---|
| 57 | |
---|
| 58 | return NULL; /* just so the compiler thinks we returned something */ |
---|
| 59 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.