[gdal-dev] Get error handler user data when removing CPL Error Handler
rajsekar at gmail.com
Sun Sep 12 07:03:10 PDT 2021
In the gdal rust bindings (https://github.com/georust/gdal), we're trying
to facilitate the use of CPLSetErrorHandlerEx and related APIs. While
setting a handler, we may pass a heap allocated data pointer to the second
argument, which is then read via the CPLGetErrorHandlerUserData in the
handler and passed to the user.
However, while removing or setting another handler, we're unable to find a
race-free method to get the associated user data of the previous handler.
This is needed to properly deallocate the memory.
Is there an atomic way to get both the previous handler (as returned by
CPLSetErrorHandler), along with the associated user data? The issue with
making two calls, is that another thread might make changes in between the
We could synchronize in our API, but it still has the same issue if the
user parallely used the C APIs directly or via a different interface.
Relevant PR in rust gdal bindings: https://github.com/georust/gdal/pull/215
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the gdal-dev