Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
From: Erik_Brown@transarc.com
Subject: Re: Looking for info on threads usage
Date: Tue,  3 Aug 1993 12:10:43 -0400	[thread overview]
Message-ID: <YgLcs3KSMUYQBjZr1F@transarc.com> (raw)
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.



  reply	other threads:[~1993-08-03 16:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <23912uINNnu9@duca.hi.com>
     [not found] ` <CAzs3I.LFo@fig.citib.com>
1993-08-02 16:06   ` Looking for info on threads usage David Wright
1993-08-03 16:10     ` Erik_Brown [this message]
1993-08-03 16:43     ` Greg Brail
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox