From 38379033c0f5ebc9f94b95be85aa6e2b713cbc5e Mon Sep 17 00:00:00 2001 From: David Schleef Date: Sun, 2 Oct 2011 12:04:57 -0700 Subject: [PATCH] init: Use global mutex, not once mutex Um, duh. orc_init() can be called when the once mutex is held. --- orc/orc.c | 6 +++--- tools/orcc.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) 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 { -- 2.7.4