diff options
Diffstat (limited to 'src/pj_ctx.c')
| -rw-r--r-- | src/pj_ctx.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/pj_ctx.c b/src/pj_ctx.c index 9ae3d4e0..89b2816f 100644 --- a/src/pj_ctx.c +++ b/src/pj_ctx.c @@ -60,8 +60,13 @@ void pj_set_ctx( projPJ pj, projCtx ctx ) projCtx pj_get_default_ctx() { + /* If already initialized, don't bother locking */ + if( default_context_initialized ) + return &default_context; + pj_acquire_lock(); + /* Ask again, since it may have been initialized in another thread */ if( !default_context_initialized ) { default_context.last_errno = 0; |
