Commit abbe17ef1ffbc264101808829a3317c1c805df96

Josh Abernathy 2015-07-22T16:01:08

Merge pull request #3322 from libgit2/fix-init-ordering Increment `git__n_inits` before doing `init_once`.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/global.c b/src/global.c
index fc6337a..37a47bd 100644
--- a/src/global.c
+++ b/src/global.c
@@ -344,8 +344,8 @@ int git_libgit2_init(void)
 {
 	int ret;
 
-	pthread_once(&_once_init, init_once);
 	ret = git_atomic_inc(&git__n_inits);
+	pthread_once(&_once_init, init_once);
 
 	return init_error ? init_error : ret;
 }