[Mesa-dev] [Mesa-stable] [PATCH] ralloc: Use __attribute__((destructor)) instead of atexit(3)

Jean-Sébastien Pédron jean-sebastien.pedron at dumbbell.fr
Thu Sep 24 06:19:35 PDT 2015


On 24.09.2015 14:55, Emil Velikov wrote:
>>>> __attribute__((destructor)) fixes the problem because such handlers are
>>>> called when a library is unloaded and when the program exits.
>>> Considering that atexit() (reportedly) works for Linux/Glibc, Solaris,
>>> Android and Windows perhaps we should consider this as a workaround
>>> for FreeBSD (and other *BSD) systems ?
>>
>> On one hand, my concern is this behavior is an extension to the standard
>> and it could break for someone else. On the other hand, I don't like the
>> standard behavior and would be glad to see FreeBSD implement this extension.
>>
>> I still think relying on this atexit(3) extension is fragile and I don't
>> consider the use of the attribute a workaround.
>>
>>> Considering the multiple users (mentioned above) should one set
>>> priority for the destructors ?
>>
>> You are right, I didn't think of the calling order of the destructors.
>
> Considering the way the discussion is going, perhaps it's better to
> add the destructor as a {Free,*}BSD only option for now ?

I will study the code more, especially regarding calling order of
destructors. If I don't find a satisfying solution, then a FreeBSD
specific solution is fine for the short term.

> We're quite early in the devel cycle, so the latter patch will get
> some testing. And if it does not work out, we can revert it.

Ok. I'm busy at the moment but will eventually come back to this later
in October.

> P.S. I will be revisiting the loader/libudev sometime soon,
> effectively pushing the chaos into libdrm. You should get a lovely
> warning (missing implementation of XXX) when compiling libdrm, for
> which patches will be gladly accepted :-)

Noted, thanks for the heads-up!

-- 
Jean-Sébastien Pédron

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150924/b1e2da20/attachment.sig>


More information about the mesa-dev mailing list