source: rtems/c/src/tests/psxtests/psx08/init.c @ 20de272

4.104.114.84.95
Last change on this file since 20de272 was 20de272, checked in by Joel Sherrill <joel.sherrill@…>, on 08/02/96 at 18:25:16

join/detach basic tests pass

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
3 *  On-Line Applications Research Corporation (OAR).
4 *  All rights assigned to U.S. Government, 1994.
5 *
6 *  This material may be reproduced by or for the U.S. Government pursuant
7 *  to the copyright license under the clause at DFARS 252.227-7013.  This
8 *  notice must appear in all copies of this file and its derivatives.
9 *
10 *  $Id$
11 */
12
13#define CONFIGURE_INIT
14#include "system.h"
15#include <errno.h>
16
17void *POSIX_Init(
18  void *argument
19)
20{
21  int    status;
22  void  *return_pointer;
23
24  puts( "\n\n*** POSIX TEST 8 ***" );
25
26  /* set the time of day, and print our buffer in multiple ways */
27
28  set_time( TM_FRIDAY, TM_MAY, 24, 96, 11, 5, 0 );
29
30  /* get id of this thread */
31
32  Init_id = pthread_self();
33  printf( "Init's ID is 0x%08x\n", Init_id );
34
35  /* detach this thread */
36
37  puts( "Init: pthread_detach self" );
38  status = pthread_detach( pthread_self() );
39  assert( !status );
40
41  /* create thread */
42 
43  puts( "Init: creating two tasks" );
44  status = pthread_create( &Task_id, NULL, Task_1, NULL );
45  assert( !status );
46 
47  status = pthread_create( &Task2_id, NULL, Task_2, NULL );
48  assert( !status );
49 
50  puts( "Init: pthread_join - SUCCESSFUL" );
51  status = pthread_join( Task_id, &return_pointer );
52
53     /* switch to Task 1 */
54
55  puts( "Init: returned from pthread_join" );
56  if ( status )
57    printf( "status = %d\n", status );
58  assert( !status );
59
60  if ( return_pointer == &Task_id )
61    puts( "Init: pthread_join returned correct pointer" );
62  else
63    printf(
64      "Init: pthread_join returned incorrect pointer (%p != %p)\n",
65      return_pointer,
66      &Task_id
67    );
68 
69  puts( "Init: exitting" );
70  pthread_exit( NULL );
71
72  return NULL; /* just so the compiler thinks we returned something */
73}
Note: See TracBrowser for help on using the repository browser.