Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-07-03 07:47:34 +0400
committerCarlos Martín Nieto <cmn@dwim.me>2014-07-03 07:55:02 +0400
commit905fb5929bb8aa05b640d4dcb8fa611886cbe022 (patch)
treeb5fac4ef493b89c99f82a7cff81e971e55586d33 /tests/threads
parent28f087c8642ff9c8dd6964e101e6d8539db6281a (diff)
Move yield to the tests and enable for FreeBSDcmn/sched-yield
Move the definition of git_thread_yield() to the test which needs it and add the correct definition for it for FreeBSD and derivatives. Original patch adding FreeBSD and derivatives by @jacquesg.
Diffstat (limited to 'tests/threads')
-rw-r--r--tests/threads/diff.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/threads/diff.c b/tests/threads/diff.c
index 79b85800b..c32811469 100644
--- a/tests/threads/diff.c
+++ b/tests/threads/diff.c
@@ -1,6 +1,20 @@
#include "clar_libgit2.h"
#include "thread_helpers.h"
+#ifdef GIT_THREADS
+
+# if defined(GIT_WIN32)
+# define git_thread_yield() Sleep(0)
+# elif defined(__FreeBSD__) || defined(__MidnightBSD__) || defined(__DragonFly__)
+# define git_thread_yield() pthread_yield()
+# else
+# define git_thread_yield() sched_yield()
+# endif
+
+#else
+# define git_thread_yield() (void)0
+#endif
+
static git_repository *_repo;
static git_tree *_a, *_b;
static git_atomic _counts[4];