[geos-devel] Thread safe error handling

Sandro Santilli strk at keybit.net
Mon Sep 9 06:29:53 PDT 2013


On Mon, Sep 09, 2013 at 03:08:50PM +0200, Pepijn Van Eeckhoudt wrote:

> @@ -361,11 +445,11 @@
>      }
>      catch (const std::exception &e)
>      {
> -        handle->ERROR_MESSAGE("%s", e.what());
> +        handle->ERROR_MESSAGE(handle, handle->errorData, "%s", e.what());

You should need to change anything in the callers if you made
"handle" an instance of GEOSContextHandleInternal_t class.
It should be enough to change initGEOS_r to do

    extHandle = new GEOSContextHandleInternal_t();

instead of

    extHandle = malloc(sizeof(GEOSContextHandleInternal_t));

And finishGEOS_r to do:

    delete extHandle;

instead of 

    free(extHandle);

PS: if you're comfortable with git, consider forking from the official
    git mirror: https://github.com/postgis/postgis/

--strk;


More information about the geos-devel mailing list