Signal Handlers using sigwait

After an extensive search, I haven't found a definitive answer to my question. "And what is your question you frackking noob", you may ask. Ok, here goes: When using sigwait to wait for SIGUSR1 or SIGUSR2, can you have it trigger a signal handler? The following code did NOT, and the example I got it from said it did not. But WHY did it not? Can I make it call a signal handler?

#include <signal.h>
#include <unistd.h>
#include <stdio.h>
#include <time.h>

extern int errno;

void catcher( int sig ) {
    printf( "Signal catcher called for signal %d\n", sig );
}

void timestamp( char *str ) 
{
    time_t t;
    time( T );
    printf( "The time %s is %s\n", str, ctime(T) );
}

int main( int argc, char *argv[] ) 
{
    struct sigaction sigact;
    sigset_t waitset;
    int sig;
    int result = 0;

    sigemptyset( &sigact.sa_mask );
    sigact.sa_flags = 0;
    sigact.sa_handler = catcher;

    sigaction( SIGUSR1, &sigact, NULL );
    sigaction( SIGUSR2, &sigact, NULL );
    sigaction( SIGALRM, &sigact, NULL );
    sigaction( SIGHUP,  &sigact, NULL );

    sigemptyset( &waitset );
    sigaddset( &waitset, SIGUSR1);
    sigaddset( &waitset, SIGUSR2);
    sigaddset( &waitset, SIGALRM);
    sigaddset( &waitset, SIGHUP);

    

    sigprocmask( SIG_BLOCK, &waitset, NULL );

    while(1)
    {
        timestamp( "before sigwait()" );
        result = sigwait(&saitset, &sig) ;
        if(result == 0)
        {
            printf( "sigwait() returned for signal %d\n", sig );
        else 
        {
            printf( "sigwait() returned error number %d\n", errno );
            perror( "sigwait() function failed\n" );
        }

        timestamp( "after sigwait()" );
    }
    return( result );
}

A similar setup with sigsuspend DOES call the handler "catcher". If it is not supposed to be able to have a handler using sigwait, can you point me to the appropriate documentation?

D. Scruggs

What platform did you test this ?

Here is something that may help you - sigwait
It says:

So it may be that the system checks for any process (/thread) waiting on a signal (via sigwait(2)) and if it finds one it returns after deleting the pending signal (from system's set), and after doing this operation it looks for the handler of the remaining signals.
But I am sure this is implementation dependent (try it on more variants - HP-UX, BSD ...)