🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3316

Re: Throwing an exception from within a signal handler

#3316
From: Tom Payne
Date: Fri, 09 Feb 1996 23:33
40 lines
2675 bytes
Dick Menninger (Dick.Menninger@daytonoh.attgis.com) wrote:
: > ==========Tom Payne, 2/4/96==========
: 
: [...]
:  
: > Atomicity of such updates to atomic variables is not always a problem.
: > For instance, in most cases a signal handler can increment an atomic
: > counter (e.g. a timer) without difficulties, even though the
: > read/modify/write sequence is not atomic.  In the case of nonatomic
: > variables, atomicity must be enforced by blocking certain signals.
: > Such blockage could be portably implemented via atomic blockage flags,
: > which, in turn, are volatile atomic variables that must be read by
: > signal handers.
: 
: Although that could keep them from reading a bad value,
: they have no way to wait for it to become valid if they
: interrupted the owner. So, the updater thread would have
: to fully block the signals that really need the value in the
: handler for handling to proceed.  That is, the problems
: are more severe than between threads that do not interrupt
: each other (a signal handler is just a specialized thread,
: whether or not the environment's terminology calls it that
: is irrelevant).

Agreed: the need to block concurrent access to shared data is often
inevitable.  To lock out standard threads during such a critical
section, one acquires a lock.  To lock out signal-sustained
pseudothreads, one blocks the corresponding signals.  It is a defining
characteristic of threads, however, that they can wait.

Tom Payne

[Moderator's note: this is a valuable discussion, but it's beginning to
drift away from C++ standardization.  I suggest continuing it in
comp.compilers.  mha]

---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy is
  in http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
Technical Details
Message-ID: <4fggbj$hsd@galaxy.ucr.edu>
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austern
References: <4f2th6$4qh@galaxy.ucr.edu> <DMH620.FKn@falcon.daytonoh.attgis.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austern
From: thp@cs.ucr.edu (Tom Payne)
Newsgroups: comp.std.c++
Subject: Re: Throwing an exception from within a signal handler
Date: 09 Feb 1996 15:33:18 PST
Organization: University of California, Riverside Department of Computer Science
Approved: austern@isolde.mti.sgi.com
Message-ID: <4fggbj$hsd@galaxy.ucr.edu>
References: <4f2th6$4qh@galaxy.ucr.edu> <DMH620.FKn@falcon.daytonoh.attgis.com>
NNTP-Posting-Host: isolde.mti.sgi.com
X-Original-Date: 9 Feb 1996 22:03:31 GMT
X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBVAwUBMRvcZUy4NqrwXLNJAQHylgH/c+cy7tnyULBlYthmVFK25zDIT/6UPZAN
 66UtB2Rz+j4DIti/3EzvZgo+OzqO2zQ3cgZlc/QrOUXp6wor/azspg==
 =RUPA
Originator: austern@isolde.mti.sgi.com