From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f678f,57421e52a70d7deb X-Google-Attributes: gidf678f,public X-Google-ArrivalTime: 1993-08-03 10:07:05 PST Path: gmd.de!xlink.net!howland.reston.ans.net!vixen.cso.uiuc.edu!sdd.hp.com!swrinde!cs.utexas.edu!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!news.sei.cmu.edu!bb3.andrew.cmu.edu!andrew.cmu.edu!postman+ From: Erik_Brown@transarc.com Newsgroups: comp.unix.osf.misc Subject: Re: Looking for info on threads usage Date: Tue, 3 Aug 1993 12:10:43 -0400 Organization: Carnegie Mellon, Pittsburgh, PA Message-ID: References: <23912uINNnu9@duca.hi.com> <23js4sINNsjt@duca.hi.com> NNTP-Posting-Host: po5.andrew.cmu.edu In-Reply-To: <23js4sINNsjt@duca.hi.com> wright@duca.hi.com (David Wright) writes: > > [stuff deleted] > > We support sigwait(), but only for the original thread in a process. > That's because all asynchronously-generated signals are fed to that > thread. Any child threads can only receive synchronously-generated > signals (e.g. SIGILL, SIGFPE). This is how our Mach implementation > (OSF/1) does it. I have ground my teeth about this more than once, > but for now we're stuck with it. > > This is the reason we can't do signal_to_cancel_np; that call wants to > spawn off a child thread to act as a signal interceptor, which in our > setup it is incapable of doing. > > So, in conclusion, do you (or anyone else -- don't be shy, speak right > up!) think this is a serious limitation? I'd hate to go to user > threads now if I don't have to. I think the benefits from using OS threads are substantial, so I would stay away from user threads if possible. However, I don't completely understand why you can't implement a generic sigwait(). Could you implement sigwait() to record the desired signals and wait on a condition variable? The main thread then has a handler for all signals. When a signal comes into the main thread, you look to see if any other thread is expecting this signal. If so, then you wake up that thread's condition variable. If not, then you provide the default signal behavior. Perhaps I'm missing something, but would this work? I would expect programs to call sigwait() on signals like SIGINT (Ctrl-C), and I doubt users will assume that they must restrict these calls to the initial thread. In fact, it's probably more likely that they'll spawn a waiter thread from which they call sigwait(). Erik Brown Transarc ps. the above comments are my own and in no way reflects the opinion or position of Transarc Corp.