diff options
| -rw-r--r-- | ChangeLog | 3 | ||||
| -rw-r--r-- | src/pj_ctx.c | 4 |
2 files changed, 5 insertions, 2 deletions
@@ -1,5 +1,8 @@ 2013-06-25 Frank Warmerdam <warmerdam@pobox.com> + * src/pj_ctx.c: avoid race condition on setting of + default_context_initialized. (#199) + * config.guess, config.sub: updated to newer versions (#208). * src/proj.def: add pj_get_spheroid_defn to proj.def. (#214) diff --git a/src/pj_ctx.c b/src/pj_ctx.c index d34dac2c..048baf4a 100644 --- a/src/pj_ctx.c +++ b/src/pj_ctx.c @@ -33,7 +33,7 @@ PJ_CVSID("$Id$"); static projCtx_t default_context; -static int default_context_initialized = 0; +static volatile int default_context_initialized = 0; /************************************************************************/ /* pj_get_ctx() */ @@ -68,7 +68,6 @@ projCtx pj_get_default_ctx() if( !default_context_initialized ) { - default_context_initialized = 1; default_context.last_errno = 0; default_context.debug_level = PJ_LOG_NONE; default_context.logger = pj_stderr_logger; @@ -82,6 +81,7 @@ projCtx pj_get_default_ctx() else default_context.debug_level = PJ_LOG_DEBUG_MINOR; } + default_context_initialized = 1; } pj_release_lock(); |
