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
|
Line | |
---|
1 | /* Task_1 |
---|
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 | * |
---|
11 | * COPYRIGHT (c) 1989-2009. |
---|
12 | * On-Line Applications Research Corporation (OAR). |
---|
13 | * |
---|
14 | * The license and distribution terms for this file may be |
---|
15 | * found in the file LICENSE in this distribution or at |
---|
16 | * http://www.rtems.org/license/LICENSE. |
---|
17 | */ |
---|
18 | |
---|
19 | #ifdef HAVE_CONFIG_H |
---|
20 | #include "config.h" |
---|
21 | #endif |
---|
22 | |
---|
23 | #include "system.h" |
---|
24 | #include <errno.h> |
---|
25 | |
---|
26 | void *Task_1( |
---|
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 ); |
---|
36 | rtems_test_assert( status == EBUSY ); |
---|
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 ); |
---|
42 | rtems_test_assert( !status ); |
---|
43 | |
---|
44 | /* switch to init */ |
---|
45 | |
---|
46 | printf( "Task: mutex acquired\n" ); |
---|
47 | |
---|
48 | printf( "Task: sleep for 2 seconds\n" ); |
---|
49 | sleep( 2 ); |
---|
50 | |
---|
51 | /* switch to init */ |
---|
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.