summaryrefslogtreecommitdiff
path: root/orc/orccodemem.c
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2011-08-27 20:51:37 -0700
committerDavid Schleef <ds@schleef.org>2011-08-27 20:51:37 -0700
commitb06d6f77247a37db49c7ca0ff582e0e47c7ff11f (patch)
tree6be835aff84b5940bd12d6a40c981fcfbb829a59 /orc/orccodemem.c
parent3076c702d8435ec96552bb9c1d49ec0f33384a7c (diff)
downloadorc-b06d6f77247a37db49c7ca0ff582e0e47c7ff11f.tar.gz
Protect codemem globals with mutex
Diffstat (limited to 'orc/orccodemem.c')
-rw-r--r--orc/orccodemem.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/orc/orccodemem.c b/orc/orccodemem.c
index 032f7fc..f470be5 100644
--- a/orc/orccodemem.c
+++ b/orc/orccodemem.c
@@ -120,10 +120,12 @@ orc_code_region_get_free_chunk (int size)
OrcCodeRegion *region;
OrcCodeChunk *chunk;
+ orc_global_mutex_lock ();
for(i=0;i<orc_code_n_regions;i++){
region = orc_code_regions[i];
for(chunk = region->chunks; chunk; chunk = chunk->next) {
if (!chunk->used && size <= chunk->size) {
+ orc_global_mutex_unlock ();
return chunk;
}
}
@@ -137,9 +139,11 @@ orc_code_region_get_free_chunk (int size)
for(chunk = region->chunks; chunk; chunk = chunk->next) {
if (!chunk->used && size <= chunk->size){
+ orc_global_mutex_unlock ();
return chunk;
}
}
+ orc_global_mutex_unlock ();
ORC_ASSERT(0);