From 977bd9f7719f56b372c4d19315e77d731702d60e Mon Sep 17 00:00:00 2001 From: Frank Warmerdam Date: Wed, 26 Jun 2013 05:28:20 +0000 Subject: fix race condition on setting default_context_initialized (#199) git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2364 4e78687f-474d-0410-85f9-8d5e500ac6b2 --- src/pj_ctx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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(); -- cgit v1.2.3