Hi Jean-Sébastien,

On 3 September 2015 at 19:07, Jean-Sébastien Pédron
<jean-sebastien.ped...@dumbbell.fr> wrote:
> ... to free the ralloc context at program exit.
>
> On Linux, atexit(3) handlers are called when the program exits but also
> when a library is unloaded. The latter behavior is a Glibc extension.
>
> On systems where this extension is not supported, this causes an
> application to crash when, for instance, a library using ralloc is
> dlclosed: at program exit, the registered function is no longer in
> memory. For example, this happens with OpenCL applications using an ICD
> loader on FreeBSD.
>
We have 4(5) users of atexit() - EGL, gallium trace driver, core mesa
and util/ralloc. The latter of which is used almost everywhere in
mesa. So a bit I'm confused how you hit this only with OpenCL :-\
Perhaps the others should be updated as well ?

> __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 ?

Considering the multiple users (mentioned above) should one set
priority for the destructors ?

Cheers,
Emil
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to