🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.programming.threads
Article #20

Re: Is STL MT-Safe?

#20
From: David Brownell
Date: Sun, 21 Apr 1996 07:00
37 lines
2529 bytes
Tom Payne wrote:
> 
> The second major need is to allow a signal to force an exception in
> without the program polling for it.

I guess we'll just disagree on this ... I see signals as basically
asynchronous, and exceptions as wholly synchronous.  Plus, exactly
which exceptions are legal will vary depending on the state of the
thread's execution (i.e. the "throw" specification of the function
being executed).  So it doesn't make sense to me to mix the two.

If you want signals to cause exceptions, it's simple enough to code
the handoff between signal handling thread and the exception-raising
one ... either sigwait() and pthread_cond_signal(), or else use the
older asynchronous signal handlers and a semaphore.  The thread that
blocked on the synchronization variable (sema_t or pthread_cond_t)
raises whatever exception it wants.


> 	In a thread on this
> topic a couple months ago, David Chase gave an implementation strategy
> based on range tables that seemed to involve no CPU overhead and whose
> complexity seemed reasonable.

But if the exceptions aren't synchronous, the complexity of generating
those tables can become extremely high ... particularly in conjunction
with the code motion performed as part of most optimizations.  As was
pointed out to me by David himself.
-- 
David Brownell
http://www.netcom.com/~brownell
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
Technical Details
Message-ID: <317958CE.2B89@ix.netcom.com>
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back
References: <4kmjvj$89t@usc.edu> <4kspmb$9tb@ubszh.fh.zh.ubs.com> <3173E95E.5AC@ix.netcom.com> <4l12rf$q11@galaxy.ucr.edu> <31753C02.58A6@ix.netcom.com> <4l8pud$3t8@galaxy.ucr.edu>

Show Full Headers
Complete Article Headers
From: David Brownell <brownell@ix.netcom.com>
Message-ID: <317958CE.2B89@ix.netcom.com>
X-Original-Date: Sat, 20 Apr 1996 14:36:14 -0700
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back
Date: 21 Apr 96 07:00:00 GMT
Approved: fjh@cs.mu.oz.au
Newsgroups: comp.programming.threads,comp.std.c++
Subject: Re: Is STL MT-Safe?
Organization: Dave's VAX
References: <4kmjvj$89t@usc.edu> <4kspmb$9tb@ubszh.fh.zh.ubs.com> <3173E95E.5AC@ix.netcom.com> <4l12rf$q11@galaxy.ucr.edu> <31753C02.58A6@ix.netcom.com> <4l8pud$3t8@galaxy.ucr.edu>
X-Netcom-Date: Sat Apr 20  4:37:13 PM CDT 1996
X-Mailer: Mozilla 2.0 (Win95; I)
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMXndH+EDnX0m9pzZAQFTDAF/daqzUqq+Kx1H1BC50W9aRl8lpsIDJyoc
 Fg0k8LZgET0RgTdk/3Bj1Ind+vOzQLGJ
 =Pnv2