source: rtems/testsuites/psxtests/psx10/task.c @ 39615f4

4.104.11
Last change on this file since 39615f4 was 39615f4, checked in by Ralf Corsepius <ralf.corsepius@…>, on Oct 27, 2009 at 2:10:54 PM

Use PRIxpthread_t to print pthread_t's.

  • Property mode set to 100644
File size: 1.5 KB
Line 
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-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.rtems.com/license/LICENSE.
16 *
17 *  $Id$
18 */
19
20#include "system.h"
21
22void *Task_1(
23  void *argument
24)
25{
26  int  status;
27
28/* wait for a condition variable signal from Init */
29
30  Task_id = pthread_self();
31  printf( "Task_1: ID is 0x%08" PRIxpthread_t "\n", Task_id );
32
33  status = pthread_mutex_init( &Mutex_id, NULL );
34  assert( !status );
35
36  status = pthread_mutex_lock( &Mutex_id );
37  assert( !status );
38
39  puts( "Task_1: pthread_cond_wait" );
40  status = pthread_cond_wait( &Cond1_id, &Mutex_id );
41  assert( !status );
42
43  puts( "Task_1: back from pthread_cond_wait release mutex" );
44  status = pthread_mutex_unlock( &Mutex_id );
45  assert( !status );
46
47/* wait for a condition variable broadcast from Init */
48
49  status = pthread_mutex_lock( &Mutex_id );
50  assert( !status );
51
52  puts( "Task_1: pthread_cond_wait" );
53  status = pthread_cond_wait( &Cond1_id, &Mutex_id );
54  assert( !status );
55
56  puts( "Task_1: back from pthread_cond_wait release mutex" );
57  status = pthread_mutex_unlock( &Mutex_id );
58  assert( !status );
59
60  puts( "Task_1: task exit" );
61  pthread_exit( NULL );
62
63  return NULL; /* just so the compiler thinks we returned something */
64}
Note: See TracBrowser for help on using the repository browser.