4.104.115
Last change
on this file since 39615f4 was
39615f4,
checked in by Ralf Corsepius <ralf.corsepius@…>, on 10/27/09 at 14:10:54
|
Use PRIxpthread_t to print pthread_t's.
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[f8d39b8d] | 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-1999. |
---|
| 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.com/license/LICENSE. |
---|
| 17 | * |
---|
| 18 | * $Id$ |
---|
| 19 | */ |
---|
| 20 | |
---|
| 21 | #include "system.h" |
---|
| 22 | #include <errno.h> |
---|
| 23 | |
---|
| 24 | void *Task_1( |
---|
| 25 | void *arg |
---|
| 26 | ) |
---|
| 27 | { |
---|
[78b4e2eb] | 28 | pthread_t id = *(pthread_t *) arg; |
---|
| 29 | int status; |
---|
[f8d39b8d] | 30 | uint32_t *key_data; |
---|
| 31 | |
---|
[39615f4] | 32 | printf( "Thread 0x%08" PRIxpthread_t "\n", id ); |
---|
[78b4e2eb] | 33 | printf( "Task_1: Setting the key to %d\n", 1 ); |
---|
| 34 | status = pthread_setspecific( Key_id[0], (void *)&Data_array[ 1 ] ); |
---|
[f8d39b8d] | 35 | if ( status ) |
---|
| 36 | printf( "status = %d\n", status ); |
---|
| 37 | assert( !status ); |
---|
| 38 | |
---|
[78b4e2eb] | 39 | key_data = pthread_getspecific( Key_id[0] ); |
---|
[f8d39b8d] | 40 | printf( "Task_1: Got the key value of %ld\n", |
---|
[78b4e2eb] | 41 | (unsigned long) ((uint32_t *)key_data - Data_array) ); |
---|
[f8d39b8d] | 42 | if ( status ) |
---|
| 43 | printf( "status = %d\n", status ); |
---|
| 44 | assert( !status ); |
---|
| 45 | |
---|
| 46 | puts( "Task_1: exitting" ); |
---|
| 47 | pthread_exit( NULL ); |
---|
| 48 | |
---|
| 49 | /* switch to task 2 */ |
---|
| 50 | |
---|
| 51 | return NULL; /* just so the compiler thinks we returned something */ |
---|
| 52 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.