Changeset 699fe08a in rtems


Ignore:
Timestamp:
Jun 11, 1996, 8:46:13 PM (25 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
20d099e
Parents:
c8f5ab5
Message:

Added test case which blocks a signal, sees what signals are pending, sends
that same signal to the executing thread, sees what is pending, then unblocks
that signal so the handler can execute.

Files:
2 edited

Legend:

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

    rc8f5ab5 r699fe08a  
    1616
    1717volatile int Signal_occurred;
     18volatile int Signal_count;
    1819
    1920void Signal_handler(
     
    2122)
    2223{
    23   printf( "Signal: %d caught by 0x%x\n", signo, pthread_self() );
     24  Signal_count++;
     25  printf(
     26    "Signal: %d caught by 0x%x (%d)\n",
     27    signo,
     28    pthread_self(),
     29    Signal_count
     30  );
    2431  Signal_occurred = 1;
    2532}
     
    3340  struct timespec   tr;
    3441  struct sigaction  act;
     42  sigset_t          mask;
     43  sigset_t          pending_set;
    3544
    3645  puts( "\n\n*** POSIX TEST 2 ***" );
     
    5766  /* simple signal to self */
    5867
     68  Signal_count = 0;
     69  Signal_occurred = 0;
     70
    5971  status = pthread_kill( Init_id, SIGUSR1 );
     72  assert( !status );
     73
     74  Signal_occurred = 0;
     75
     76  /* now block the signal, send it, see if it is pending, and unblock it */
     77
     78  status = sigemptyset( &mask );
     79  assert( !status );
     80
     81  status = sigaddset( &mask, SIGUSR1 );
     82  assert( !status );
     83
     84  printf( "Init: Block SIGUSR1\n" );
     85  status = sigprocmask( SIG_BLOCK, &mask, NULL );
     86  assert( !status );
     87
     88  status = sigpending( &pending_set );
     89  assert( !status );
     90  printf( "Init: Signals pending 0x%08x\n", pending_set );
     91 
     92 
     93  printf( "Init: send SIGUSR1 to self\n" );
     94  status = pthread_kill( Init_id, SIGUSR1 );
     95  assert( !status );
     96
     97  status = sigpending( &pending_set );
     98  assert( !status );
     99  printf( "Init: Signals pending 0x%08x\n", pending_set );
     100 
     101  printf( "Init: Unblock SIGUSR1\n" );
     102  status = sigprocmask( SIG_UNBLOCK, &mask, NULL );
    60103  assert( !status );
    61104
  • testsuites/psxtests/psx02/init.c

    rc8f5ab5 r699fe08a  
    1616
    1717volatile int Signal_occurred;
     18volatile int Signal_count;
    1819
    1920void Signal_handler(
     
    2122)
    2223{
    23   printf( "Signal: %d caught by 0x%x\n", signo, pthread_self() );
     24  Signal_count++;
     25  printf(
     26    "Signal: %d caught by 0x%x (%d)\n",
     27    signo,
     28    pthread_self(),
     29    Signal_count
     30  );
    2431  Signal_occurred = 1;
    2532}
     
    3340  struct timespec   tr;
    3441  struct sigaction  act;
     42  sigset_t          mask;
     43  sigset_t          pending_set;
    3544
    3645  puts( "\n\n*** POSIX TEST 2 ***" );
     
    5766  /* simple signal to self */
    5867
     68  Signal_count = 0;
     69  Signal_occurred = 0;
     70
    5971  status = pthread_kill( Init_id, SIGUSR1 );
     72  assert( !status );
     73
     74  Signal_occurred = 0;
     75
     76  /* now block the signal, send it, see if it is pending, and unblock it */
     77
     78  status = sigemptyset( &mask );
     79  assert( !status );
     80
     81  status = sigaddset( &mask, SIGUSR1 );
     82  assert( !status );
     83
     84  printf( "Init: Block SIGUSR1\n" );
     85  status = sigprocmask( SIG_BLOCK, &mask, NULL );
     86  assert( !status );
     87
     88  status = sigpending( &pending_set );
     89  assert( !status );
     90  printf( "Init: Signals pending 0x%08x\n", pending_set );
     91 
     92 
     93  printf( "Init: send SIGUSR1 to self\n" );
     94  status = pthread_kill( Init_id, SIGUSR1 );
     95  assert( !status );
     96
     97  status = sigpending( &pending_set );
     98  assert( !status );
     99  printf( "Init: Signals pending 0x%08x\n", pending_set );
     100 
     101  printf( "Init: Unblock SIGUSR1\n" );
     102  status = sigprocmask( SIG_UNBLOCK, &mask, NULL );
    60103  assert( !status );
    61104
Note: See TracChangeset for help on using the changeset viewer.