Received: from PACIFIC-CARRIER-ANNEX.MIT.EDU by po7.MIT.EDU (5.61/4.7) id AA24815; Fri, 15 Mar 96 00:05:36 EST
Received: from colgate.edu by MIT.EDU with SMTP
	id AA11562; Fri, 15 Mar 96 00:04:51 EST
Received: from CENTER.COLGATE.EDU by CENTER.COLGATE.EDU (PMDF V4.3-10 #6592)
 id <01I2CIDKY3C09A068Q@CENTER.COLGATE.EDU>; Fri,
 15 Mar 1996 00:02:41 -0500 (EST)
Date: Fri, 15 Mar 1996 00:02:41 -0500 (EST)
From: KRSNA CONSCIOUSNESS NOW <JWILSON@CENTER.COLGATE.EDU>
Subject: Re: pthreads eats mmap, select, fstreams?
To: proven@MIT.EDU
Message-Id: <01I2CIDKYN429A068Q@CENTER.COLGATE.EDU>
X-Vms-To: IN%"proven@MIT.EDU"
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-Transfer-Encoding: 7BIT


I have also found a bug/feature regarding signal handling during sleeps.
(Is there some documentation that defines pthreads' behavior I could look 
at instead of bothering you? I know about the stuff on your web page (I have
my own copy, actually), but that's just api, it doesn't say what happens
when you send a signal to a threaded process, whether signal handling is
thread-specific or global, what signals libpthreads reserves for itself,
etc....) The following program illustrates the issue: compiled normally,
it displays the signal handler's message and exits upon receiving usr1.
Linked with libpthread, it does nothing upon first getting the signal
and dies upon getting it a second time. 

If this is a feature, I'm unhappy; I have an application that will 
generally be in a sleeping state (many threads waiting for io), which needs
to handle signals (sigterm for graceful shutdown, e.g.).

#include <pthread.h>
#include <iostream.h>
#include <signal.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>

void handler (int sig)
{
   cout << "Got signal: " << strsignal (sig) << endl;
   exit (0);
}

int main (void)
{
   signal (SIGUSR1, handler);
   while (1)
     {
        sleep (1);
     }
}
