From: Sandro Santilli Date: Fri, 4 May 2012 11:21:18 +0000 (+0000) Subject: Turn custom allocators into an occasion for interruption (#1802) X-Git-Tag: 2.0.1~95 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d3b8a9c3a6dc43304ab902e271ff9c5a49362b5a;p=postgis Turn custom allocators into an occasion for interruption (#1802) This change allows interrupting any function at allocation time. Doesn't allow interrupting loops not invoking custom allocators (includes GEOS, so far). git-svn-id: http://svn.osgeo.org/postgis/trunk@9715 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/libpgcommon/lwgeom_pg.c b/libpgcommon/lwgeom_pg.c index 308f1d136..2afd8cf60 100644 --- a/libpgcommon/lwgeom_pg.c +++ b/libpgcommon/lwgeom_pg.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "../postgis_config.h" #include "liblwgeom.h" @@ -116,6 +117,8 @@ pg_alloc(size_t size) { void * result; + CHECK_FOR_INTERRUPTS(); /* give interrupter a chance */ + POSTGIS_DEBUGF(5, " pg_alloc(%d) called", (int)size); result = palloc(size); @@ -135,6 +138,8 @@ pg_realloc(void *mem, size_t size) { void * result; + CHECK_FOR_INTERRUPTS(); /* give interrupter a chance */ + POSTGIS_DEBUGF(5, " pg_realloc(%p, %d) called", mem, (int)size); result = repalloc(mem, size);