Email List: Xaustin-group-lX
[All Lists]

Re: AI 42: atexit() and dlclose()

To: Dave Butenhof <yyyyyyyyyyyyyy@xxxxxxxxxx>
Subject: Re: AI 42: atexit() and dlclose()
From: "Clive D.W. Feather" <yyyyy@xxxxxxxxx>
Date: Wed, 14 Mar 2001 13:01:23 +0000
Cc: Mark Brown <yyyyy@xxxxxxxxxx>, Austin Group <yyyyyyyyyyyyyy@xxxxxxxxxxxxx>
References: <B6D3DFD4.3655%bmark@us.ibm.com> <3AAF56DD.969EB1FD@compaq.com>
Dave Butenhof said:
>> An exception is that a function is called after
>>           any previously registered functions that had already been called
>>           at the time it was registered.
> 
> I don't understand the intent of this. (Yes, I see that it is a minor 
>adjustment to
> a previous addition to XSH6, which I apparently missed entirely.) Anyone know 
>if
> this is supposed to refer to the behavior of exit handlers declared within 
>exit
> handlers?

Yes, and it's there for C99 consistency.

    main () { ... atexit (handler_a); ... }

    handler_a () { ... atexit (handler_b); ... }

Without this wording the requirement is that handler_b is called before
handler_a, which is obviously nonsense. It's also been interpreted by
people as requiring handler_b to be called within the atexit call. This
wording makes it clear that handler_b is called as soon as handler_a exits.

> The change history provides no explanation. (The only
> justified changes are for alignment with C99, and this text does not come from
> C99.)

Yes it does: 7.20.4.3 paragraph 3:

    "except that  a  function  is  called  after  any  previously
    registered  functions  that  had  already been called at the
    time it was registered"

-- 
Clive D.W. Feather  | Work:  <yyyyy@xxxxxxxxx>   | Tel:  +44 20 8371 1138
Internet Expert     | Home:  <yyyyy@xxxxxxxxxx>  | Fax:  +44 20 8371 1037
Demon Internet      | WWW: http://www.davros.org | DFax: +44 20 8371 4037
Thus plc            |                            | Mobile: +44 7973 377646 

<Prev in Thread] Current Thread [Next in Thread>