Kaynağa Gözat

Fix G_is_initialized() for case of concurrent initialisation attempts

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@37162 15284696-431f-4ddb-bdfa-cd5b030d7da7
Glynn Clements 16 yıl önce
ebeveyn
işleme
aff756a341
1 değiştirilmiş dosya ile 5 ekleme ve 0 silme
  1. 5 0
      lib/gis/counter.c

+ 5 - 0
lib/gis/counter.c

@@ -64,6 +64,11 @@ int G_is_initialized(int *p)
 #ifdef HAVE_PTHREAD_H
     make_mutex();
     pthread_mutex_lock(&mutex);
+
+    if (*p) {
+	pthread_mutex_unlock(&mutex);
+	return 1;
+    }
 #endif
     return 0;
 }