From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: <20141106210544.GA20298@localhost> <3600f4a8554d9bc476742f16a142efcf@ladd.quanstro.net> Date: Thu, 6 Nov 2014 13:44:30 -0800 Message-ID: From: Skip Tavakkolian To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=001a113df3fae9173305073799b8 Subject: Re: [9fans] atexit() & atexitdont() Topicbox-Message-UUID: 246318b0-ead9-11e9-9d60-3106f5b1d025 --001a113df3fae9173305073799b8 Content-Type: text/plain; charset=UTF-8 i'm wondering if "print" is the right instrument for knowing the order is right. On Thu, Nov 6, 2014 at 1:42 PM, Skip Tavakkolian wrote: > according to the man page: > > "Before calling _exits with msg as an argument, exits calls in reverse > order all the functions recorded by atexit." > > so i think your result should be f2, f1, f1. > > > On Thu, Nov 6, 2014 at 1:26 PM, erik quanstrom > wrote: > >> On Thu Nov 6 16:07:56 EST 2014, lego12239@yandex.ru wrote: >> > Hi, all. >> > >> > I looked at atexit() and atexitdont() and i don't understand why these >> > functions are implemented with a static array instead of singly linked >> list? >> > May be somebody with a greater plan9 experience can help me with my >> question. >> >> perhaps a linked list would make sense, but atexits(2) doesn't say which >> order >> the functions will be run in. and it doesn't seem like a great idea to >> depend on >> atexits running things in a particular order. >> >> - erik >> >> > --001a113df3fae9173305073799b8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
i'm wondering if "print" is the right instru= ment for knowing the order is right.

On Thu, Nov 6, 2014 at 1:42 PM, Skip Tavakkolian <= span dir=3D"ltr"><skip.tavakkolian@gmail.com> wrote:
according to the man page:

"Before calling _exits with msg as an argument, exits cal= ls in reverse order all the functions recorded by atexit."
=

so i think your result should be f2, f1, f1.
=

On Thu, Nov 6, 2014 at 1:26 PM, erik= quanstrom <quanstro@quanstro.net> wrote:
On Thu Nov=C2=A0 6 16:07:56 EST 2014, lego12239@yandex.ru wrote= :
>=C2=A0 =C2=A0Hi, all.
>
> I looked at atexit() and atexitdont() and i don't understand why t= hese
> functions are implemented with a static array instead of singly linked= list?
> May be somebody with a greater plan9 experience can help me with my qu= estion.

perhaps a linked list would make sense, but atexits(2) doesn't s= ay which order
the functions will be run in.=C2=A0 and it doesn't seem like a great id= ea to depend on
atexits running things in a particular order.

- erik



--001a113df3fae9173305073799b8--