From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <20141107105708.cOSXGRv3%sdaoden@yandex.com> References: <20141106210544.GA20298@localhost> <20141107094425.GA29497@localhost> <20141107105708.cOSXGRv3%sdaoden@yandex.com> Date: Fri, 7 Nov 2014 11:49:08 +0000 Message-ID: From: Charles Forsyth To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=f46d043be1d294a5a20507436626 Subject: Re: [9fans] atexit() & atexitdont() Topicbox-Message-UUID: 24af3a1a-ead9-11e9-9d60-3106f5b1d025 --f46d043be1d294a5a20507436626 Content-Type: text/plain; charset=UTF-8 On 7 November 2014 10:57, Steffen Nurpmeso wrote: > Safety against asynchronous un-/registration can't be it, anyway. No, there's a lock. I meant avoiding too many possible interactions between low-level run-time functions and the rest of the library. (I'd consider atexit and exit to be lower-level functions than malloc.) Since atexit is already used by profile, and is called by _profmain, which is called very early on, putting a call to malloc in that chain means you have to think that much harder about interactions that are already quite subtle. Note that _profmain allocates its memory directly using sbrk, probably for that reason. Suppose I later want to add a malloc profiler, can I call atexit to write the results, or not? --f46d043be1d294a5a20507436626 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

= On 7 November 2014 10:57, Steffen Nurpmeso <sdaoden@yandex.com> wrote:
Safety against asynchronous u= n-/registration can't be it, anyway.

No, there= 9;s a lock. I meant avoiding too many possible interactions between low-lev= el run-time
functions and the rest of the l= ibrary. (I'd consider atexit and exit to be lower-level functions than = malloc.)
Since atexit is already used by pr= ofile, and is called by _profmain, which is called very early on,
putting a call to malloc in that chain means you hav= e to think that much harder about interactions that are already quite subtl= e.
Note that _profmain allocates its memory= directly using sbrk, probably for that reason.
Suppose I later want to add a malloc profiler, can I call atexit to wr= ite the results, or not?
--f46d043be1d294a5a20507436626--