diff options
author | David Schleef <ds@schleef.org> | 2011-10-02 23:04:57 +0400 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2011-10-02 23:04:57 +0400 |
commit | 38379033c0f5ebc9f94b95be85aa6e2b713cbc5e (patch) | |
tree | 6a294ac96c254d99d8df111c363d1d51988558d3 | |
parent | 320a88376697f81c3d0a3c4eaf362d1c2ff08997 (diff) |
init: Use global mutex, not once mutex
Um, duh. orc_init() can be called when the once mutex is held.
-rw-r--r-- | orc/orc.c | 6 | ||||
-rw-r--r-- | tools/orcc.c | 2 |
2 files changed, 4 insertions, 4 deletions
@@ -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 { |