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

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.5 KB
RevLine 
[e9624663]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 *
[08311cc3]10 *  COPYRIGHT (c) 1989-1999.
[e9624663]11 *  On-Line Applications Research Corporation (OAR).
12 *
[98e4ebf5]13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
[3c48599]15 *  http://www.rtems.com/license/LICENSE.
[e9624663]16 *
17 *  $Id$
18 */
19
20#include "system.h"
21
22void *Task_1(
23  void *argument
24)
25{
26  int  status;
27
[1d428a3c]28/* wait for a condition variable signal from Init */
29
[e9624663]30  Task_id = pthread_self();
[39615f4]31  printf( "Task_1: ID is 0x%08" PRIxpthread_t "\n", Task_id );
[e9624663]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
[1d428a3c]47/* wait for a condition variable broadcast from Init */
48
[e9624663]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
[1d428a3c]60  puts( "Task_1: task exit" );
[e9624663]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.