diff options
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/graph.y | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/libglusterfs/src/graph.y b/libglusterfs/src/graph.y index a640f2402..e0fbd169b 100644 --- a/libglusterfs/src/graph.y +++ b/libglusterfs/src/graph.y @@ -18,6 +18,7 @@ #include <sys/mman.h> #include <sys/types.h> #include <sys/wait.h> +#include <pthread.h> #define RELAX_POISONING @@ -555,6 +556,7 @@ glusterfs_graph_construct (FILE *fp) int ret = 0; glusterfs_graph_t *graph = NULL; FILE *tmp_file = NULL; + static pthread_mutex_t graph_mutex = PTHREAD_MUTEX_INITIALIZER; graph = glusterfs_graph_new (); if (!graph) @@ -580,13 +582,14 @@ glusterfs_graph_construct (FILE *fp) return NULL; } - yyin = tmp_file; - - construct = graph; - - ret = yyparse (); - - construct = NULL; + pthread_mutex_lock (&graph_mutex); + { + yyin = tmp_file; + construct = graph; + ret = yyparse (); + construct = NULL; + } + pthread_mutex_unlock (&graph_mutex); fclose (tmp_file); |