[geos-devel] Thread safe error handling

Pepijn Van Eeckhoudt pepijn at vaneeckhoudt.net
Fri Sep 6 16:23:25 PDT 2013


Hi,

I'm using GEOS via the C api in libgpkg to implement geometry functions. I got the basics working now, but it feels like I had to jump through a lot of hoops to get the error handling set up reliably. The main problem I had was that there's no way to associate user data with the error and notice callbacks. Since this library may be used in a multi-threaded context I ended up having to use thread-local storage to store the error message. This feels more complicated than it should be.

Is there a simpler way to achieve the same result with the current API that I might have missed?

Thanks,

Pepijn


More information about the geos-devel mailing list