Changeset ce78b894 in rtems


Ignore:
Timestamp:
07/04/96 17:38:55 (26 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
69c9543
Parents:
c6d15c2
Message:

added test case for timeout using pthread_mutex_timedlock

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • c/src/tests/psxtests/psx05/init.c

    rc6d15c2 rce78b894  
    7878  int                  status;
    7979  pthread_mutexattr_t  attr;
     80  struct timespec      times;
    8081
    8182  puts( "\n\n*** POSIX TEST 5 ***" );
     
    165166  assert( status == EPERM );
    166167
     168  times.tv_sec = 0;
     169  times.tv_nsec = 500000000;
     170  printf( "Init: pthread_mutex_timedlock time out in 1/2 second\n" );
     171  status = pthread_mutex_timedlock( &Mutex_id, &times );
     172  if ( status != EAGAIN )
     173    printf( "status = %d\n", status );
     174  assert( status == EAGAIN );
     175
     176     /* switch to idle */
     177
     178  printf( "Init: correctly timed out waiting for mutex\n" );
     179
    167180  puts( "*** END OF POSIX TEST 5 ***" );
    168181  exit( 0 );
  • c/src/tests/psxtests/psx05/task.c

    rc6d15c2 rce78b894  
    4141  assert( !status );
    4242
     43     /* switch to init */
     44
    4345  printf( "Task: mutex acquired\n" );
    4446
     47  printf( "Task: sleep for 2 seconds\n" );
     48  sleep( 2 );
     49
     50     /* switch to init */
    4551
    4652  printf( "Task: exit\n" );
  • testsuites/psxtests/psx05/init.c

    rc6d15c2 rce78b894  
    7878  int                  status;
    7979  pthread_mutexattr_t  attr;
     80  struct timespec      times;
    8081
    8182  puts( "\n\n*** POSIX TEST 5 ***" );
     
    165166  assert( status == EPERM );
    166167
     168  times.tv_sec = 0;
     169  times.tv_nsec = 500000000;
     170  printf( "Init: pthread_mutex_timedlock time out in 1/2 second\n" );
     171  status = pthread_mutex_timedlock( &Mutex_id, &times );
     172  if ( status != EAGAIN )
     173    printf( "status = %d\n", status );
     174  assert( status == EAGAIN );
     175
     176     /* switch to idle */
     177
     178  printf( "Init: correctly timed out waiting for mutex\n" );
     179
    167180  puts( "*** END OF POSIX TEST 5 ***" );
    168181  exit( 0 );
  • testsuites/psxtests/psx05/task.c

    rc6d15c2 rce78b894  
    4141  assert( !status );
    4242
     43     /* switch to init */
     44
    4345  printf( "Task: mutex acquired\n" );
    4446
     47  printf( "Task: sleep for 2 seconds\n" );
     48  sleep( 2 );
     49
     50     /* switch to init */
    4551
    4652  printf( "Task: exit\n" );
Note: See TracChangeset for help on using the changeset viewer.