Changeset fb39f19 in rtems


Ignore:
Timestamp:
Jun 11, 1996, 4:04:25 PM (25 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
c8f5ab5
Parents:
12aeff91
Message:

modified to test pthread_kill() to self and pthread_kill() to a blocked
thread. nanosleep() can be interrupted and return the time remaining.

Files:
4 edited

Legend:

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

    r12aeff91 rfb39f19  
    1313#define CONFIGURE_INIT
    1414#include "system.h"
     15#include <signal.h>
    1516
    1617volatile int Signal_occurred;
     
    2021)
    2122{
    22   printf( "Signal: %d caught\n", signo );
     23  printf( "Signal: %d caught by 0x%x\n", signo, pthread_self() );
    2324  Signal_occurred = 1;
    2425}
     
    2829)
    2930{
    30   int             status;
    31   struct timespec tv;
    32   struct timespec tr;
     31  int               status;
     32  struct timespec   tv;
     33  struct timespec   tr;
     34  struct sigaction  act;
    3335
    3436  puts( "\n\n*** POSIX TEST 2 ***" );
     
    4244  Init_id = pthread_self();
    4345  printf( "Init's ID is 0x%08x\n", Init_id );
     46
     47  /* install a signal handler */
     48
     49  status = sigemptyset( &act.sa_mask );
     50  assert( !status );
     51
     52  act.sa_handler = Signal_handler;
     53  act.sa_flags   = 0;
     54 
     55  sigaction( SIGUSR1, &act, NULL );
     56
     57  /* simple signal to self */
     58
     59  status = pthread_kill( Init_id, SIGUSR1 );
     60  assert( !status );
    4461
    4562  /* create a thread */
     
    6380    assert( !status );
    6481
    65     print_current_time( "Init: ", "" );
    6682    printf(
    6783      "Init: signal was %sprocessed with %d:%d time remaining\n",
  • c/src/tests/psxtests/psx02/task.c

    r12aeff91 rfb39f19  
    3232
    3333  for ( i=0 ; i<5 ; i++ ) {
    34     seconds = sleep( 1 );
    35     assert( !seconds );
    36 
    3734    print_current_time( "Task1: ", "" );
    3835    status = pthread_kill( Init_id, SIGUSR1 );
    3936    assert( !status );
     37
     38    seconds = sleep( 1 );
     39    assert( !seconds );
    4040  }
    4141  puts( "*** END OF POSIX TEST 2 ***" );
  • testsuites/psxtests/psx02/init.c

    r12aeff91 rfb39f19  
    1313#define CONFIGURE_INIT
    1414#include "system.h"
     15#include <signal.h>
    1516
    1617volatile int Signal_occurred;
     
    2021)
    2122{
    22   printf( "Signal: %d caught\n", signo );
     23  printf( "Signal: %d caught by 0x%x\n", signo, pthread_self() );
    2324  Signal_occurred = 1;
    2425}
     
    2829)
    2930{
    30   int             status;
    31   struct timespec tv;
    32   struct timespec tr;
     31  int               status;
     32  struct timespec   tv;
     33  struct timespec   tr;
     34  struct sigaction  act;
    3335
    3436  puts( "\n\n*** POSIX TEST 2 ***" );
     
    4244  Init_id = pthread_self();
    4345  printf( "Init's ID is 0x%08x\n", Init_id );
     46
     47  /* install a signal handler */
     48
     49  status = sigemptyset( &act.sa_mask );
     50  assert( !status );
     51
     52  act.sa_handler = Signal_handler;
     53  act.sa_flags   = 0;
     54 
     55  sigaction( SIGUSR1, &act, NULL );
     56
     57  /* simple signal to self */
     58
     59  status = pthread_kill( Init_id, SIGUSR1 );
     60  assert( !status );
    4461
    4562  /* create a thread */
     
    6380    assert( !status );
    6481
    65     print_current_time( "Init: ", "" );
    6682    printf(
    6783      "Init: signal was %sprocessed with %d:%d time remaining\n",
  • testsuites/psxtests/psx02/task.c

    r12aeff91 rfb39f19  
    3232
    3333  for ( i=0 ; i<5 ; i++ ) {
    34     seconds = sleep( 1 );
    35     assert( !seconds );
    36 
    3734    print_current_time( "Task1: ", "" );
    3835    status = pthread_kill( Init_id, SIGUSR1 );
    3936    assert( !status );
     37
     38    seconds = sleep( 1 );
     39    assert( !seconds );
    4040  }
    4141  puts( "*** END OF POSIX TEST 2 ***" );
Note: See TracChangeset for help on using the changeset viewer.