source: rtems/c/src/tests/psxtests/psx10/init.c @ 13642cbc

4.104.114.84.95
Last change on this file since 13642cbc was 13642cbc, checked in by Mark Johannes <Mark.Johannes@…>, on 08/08/96 at 22:26:55

Init: Original file - tests for condition variables.

  • Property mode set to 100644
File size: 2.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 <sched.h>
16
17
18void *POSIX_Init(
19  void *argument
20)
21{
22  int                 status;
23  pthread_t           thread_id;
24  pthread_condattr_t  attr;
25  int                 pshared;
26
27  puts( "\n\n*** POSIX TEST 10 ***" );
28
29  puts( "Init: pthread_condattr_init" );
30  status = pthread_condattr_init( &attr );
31  assert( !status );
32
33  puts( "Init: pthread_condattr_init - EINVAL" );
34  status = pthread_condattr_init( NULL );
35  if ( status != EINVAL )
36    printf( "status = %d\n", status );
37  assert( status == EINVAL );
38
39  puts( "Init: pthread_condattr_destroy" );
40  status = pthread_condattr_destroy( &attr );
41  assert( !status );
42
43  puts( "Init: pthread_condattr_destroy - EINVAL" );
44  status = pthread_condattr_destroy( NULL );
45  if ( status != EINVAL )
46    printf( "status = %d\n", status );
47  assert( status == EINVAL );
48
49  puts( "Init: pthread_condattr_setpshared - PTHREAD_PROCESS_SHARED" );
50  status = pthread_condattr_setpshared( &attr, PTHREAD_PROCESS_SHARED );
51  assert( !status );
52
53  puts( "Init: pthread_condattr_setpshared - PTHREAD_PROCESS_PRIVATE" );
54  status = pthread_condattr_setpshared( &attr, PTHREAD_PROCESS_PRIVATE );
55  assert( !status );
56
57  puts( "Init: pthread_condattr_setpshared - EINVAL - attr" );
58  status = pthread_condattr_setpshared( NULL, PTHREAD_PROCESS_PRIVATE );
59  if ( status != EINVAL )
60    printf( "status = %d\n", status );
61  assert( status == EINVAL );
62
63  puts( "Init: pthread_condattr_setpshared - EINVAL - pshared" );
64  status = pthread_condattr_setpshared( &attr, 0xFFFFFF );
65  if ( status != EINVAL )
66    printf( "status = %d\n", status );
67  assert( status == EINVAL );
68
69  status = pthread_condattr_getpshared( &attr, &pshared );
70  assert( !status );
71  printf( "Init: pthread_condattr_getpshared - %d", pshared );
72
73  puts( "Init: pthread_condattr_getpshared - EINVAL" );
74  status = pthread_condattr_getpshared( NULL, &pshared );
75  if ( status != EINVAL )
76    printf( "status = %d\n", status );
77  assert( status == EINVAL );
78
79  Init_id = pthread_self();
80  printf( "Init: ID is 0x%08x\n", Init_id );
81
82  /* create a thread */
83
84/*
85  status = pthread_create( &thread_id, NULL, Task_1_through_3, NULL );
86  assert( !status );
87*/
88
89  /* exit this thread */
90
91  pthread_exit( NULL );
92
93  return NULL; /* just so the compiler thinks we returned something */
94}
Note: See TracBrowser for help on using the repository browser.