From: David Schleef Date: Sun, 2 Oct 2011 19:04:57 +0000 (-0700) Subject: init: Use global mutex, not once mutex X-Git-Tag: orc-0.4.16~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=38379033c0f5ebc9f94b95be85aa6e2b713cbc5e;p=platform%2Fupstream%2Forc.git init: Use global mutex, not once mutex Um, duh. orc_init() can be called when the once mutex is held. --- diff --git a/orc/orc.c b/orc/orc.c index c359eb2..8a607c4 100644 --- a/orc/orc.c +++ b/orc/orc.c @@ -29,10 +29,10 @@ void _orc_compiler_init(void); void orc_init (void) { - static int inited = FALSE; + static volatile int inited = FALSE; if (!inited) { - orc_once_mutex_lock (); + orc_global_mutex_lock (); if (!inited) { ORC_ASSERT(sizeof(OrcExecutor) == sizeof(OrcExecutorAlt)); @@ -61,7 +61,7 @@ orc_init (void) inited = TRUE; } - orc_once_mutex_unlock (); + orc_global_mutex_unlock (); } } diff --git a/tools/orcc.c b/tools/orcc.c index 54ea870..304fd38 100644 --- a/tools/orcc.c +++ b/tools/orcc.c @@ -718,7 +718,7 @@ output_code_execute (OrcProgram *p, FILE *output, int is_inline) } } } else { - fprintf(output, " static int p_inited = 0;\n"); + fprintf(output, " static volatile int p_inited = 0;\n"); if (use_code) { fprintf(output, " static OrcCode *c = 0;\n"); } else {