🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4315

Re: longjmp/signals

#4315
From: Nick Maclaren
Date: Wed, 01 Nov 1995 17:14
36 lines
1970 bytes
In article <815242697snz@soliton.demon.co.uk>,
Ian Cargill <ian@soliton.demon.co.uk> writes:
|> The standard says (my caps):
|> 
|> #  However, if the longjmp function is invoked from a nested 
|> #  signal handler (that is, from a function invoked as a result 
|> #  of A SIGNAL RAISED during the handling of another signal), 
|> #  the behavior is undefined.
|> 
|> ....  
|> 
|> Since there is no way of disabling external interrupts, this would seem 
|> to make it impossible to guarantee defined behaviour.

You are correct, it does.  This isn't the only thing in this area that
makes it impossible to write practical, portable signal handlers.  I can
witness that this corresponds to the actual state of affairs in most
modern 'operating systems' :-(

POSIX defines a separate mechanism that does allow for disabling external
interrupts, but it isn't half as general or flexible as its proponents
make out.  In any case, I rarely write code that is intended to run only
on UNIX-like systems (i.e. ones for which POSIX is relevant).

To be fair to X3J11, there is no form of wording that is simultaneously
adequate for writing portable applications and implementable on a wide
range of systems.  I could go on all night about the deficiencies in the
signal handling of many different systems, but I won't!  However, the
current wording in the standard is definitely sub-optimal and deceptive.


Nick Maclaren,
University of Cambridge Computer Laboratory,
New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
Email:  nmm1@cam.ac.uk
Tel.:  +44 1223 334761    Fax:  +44 1223 334679
Technical Details
Message-ID: <4789t7$rig@lyra.csx.cam.ac.uk>
Path: arc1-ca.pugleaf.net!lyra.csx.cam.ac.uk!nmm1
References: <815242697snz@soliton.demon.co.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!lyra.csx.cam.ac.uk!nmm1
From: nmm1@cus.cam.ac.uk (Nick Maclaren)
Newsgroups: comp.std.c
Subject: Re: longjmp/signals
Date: 1 Nov 1995 17:14:15 GMT
Organization: University of Cambridge, England
Message-ID: <4789t7$rig@lyra.csx.cam.ac.uk>
References: <815242697snz@soliton.demon.co.uk>
NNTP-Posting-Host: ursa.cus.cam.ac.uk