Hi,

I have a small program shown below:

/* sigwait.c */
#include <signal.h>
#include <pthread.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>

static sigset_t    initSigMask;

void *waitth(void *);
void main(int argc,char *argv[])
{
    pthread_t pth1;
    int rc;
    rc = sigemptyset(&initSigMask);
    rc = sigaddset(&initSigMask,atoi(argv[1] ));
    rc = sigprocmask(SIG_BLOCK,&initSigMask,NULL);

    pthread_create(&pth1,(void *)NULL,waitth,(void *)NULL);
    while(1);
}

void *waitth(void *p)
{
   int k;
   int       rc;
   fprintf(stderr,"thread created\n");

   while(1) {   
       rc = sigwait(&initSigMask,&k);
       fprintf(stderr,"k = %d %d %d\n",k,errno,rc);
   }
}

I compile it and run as below:
#./sigwait 24

This should print k = 24,0,0 and then the thread should again go into wait. But 
instead the program gets the signal 24 and is stopped(basically, it executes 
the default signal handler of SIGTSTP).  

This program works fine on other platforms like HP, AIX and Linux. 
Can anyone tell me why this is not working on solaris?

Thanks
 
 
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to