1 | /* Task_1 |
---|
2 | * |
---|
3 | * This routine serves as a test task. |
---|
4 | * |
---|
5 | * Input parameters: |
---|
6 | * argument - task argument |
---|
7 | * |
---|
8 | * Output parameters: NONE |
---|
9 | * |
---|
10 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
12 | * All rights assigned to U.S. Government, 1994. |
---|
13 | * |
---|
14 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
15 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
16 | * notice must appear in all copies of this file and its derivatives. |
---|
17 | * |
---|
18 | * $Id$ |
---|
19 | */ |
---|
20 | |
---|
21 | #include "system.h" |
---|
22 | |
---|
23 | void *Task_1( |
---|
24 | void *argument |
---|
25 | ) |
---|
26 | { |
---|
27 | int status; |
---|
28 | |
---|
29 | Task_id = pthread_self(); |
---|
30 | printf( "Task_1: ID is 0x%08x\n", Task_id ); |
---|
31 | |
---|
32 | status = pthread_mutex_init( &Mutex_id, NULL ); |
---|
33 | assert( !status ); |
---|
34 | |
---|
35 | status = pthread_mutex_lock( &Mutex_id ); |
---|
36 | assert( !status ); |
---|
37 | |
---|
38 | puts( "Task_1: pthread_cond_wait" ); |
---|
39 | status = pthread_cond_wait( &Cond1_id, &Mutex_id ); |
---|
40 | assert( !status ); |
---|
41 | |
---|
42 | puts( "Task_1: back from pthread_cond_wait release mutex" ); |
---|
43 | status = pthread_mutex_unlock( &Mutex_id ); |
---|
44 | assert( !status ); |
---|
45 | |
---|
46 | status = pthread_mutex_lock( &Mutex_id ); |
---|
47 | assert( !status ); |
---|
48 | |
---|
49 | puts( "Task_1: pthread_cond_wait" ); |
---|
50 | status = pthread_cond_wait( &Cond1_id, &Mutex_id ); |
---|
51 | assert( !status ); |
---|
52 | |
---|
53 | puts( "Task_1: back from pthread_cond_wait release mutex" ); |
---|
54 | status = pthread_mutex_unlock( &Mutex_id ); |
---|
55 | assert( !status ); |
---|
56 | |
---|
57 | pthread_exit( NULL ); |
---|
58 | |
---|
59 | return NULL; /* just so the compiler thinks we returned something */ |
---|
60 | } |
---|