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:
authorRussell Belfer <rb@github.com>2013-08-22 03:50:03 +0400
committerRussell Belfer <rb@github.com>2013-08-22 03:50:03 +0400
commitb37359aac5b02f59c07b453b53191432abc0f942 (patch)
tree2c0324747a0d20b5c29c73c3da04930879376c46 /tests-clar/threads
parentfe3727408001f9708aad09562ffae5b82c0f7171 (diff)
Fix warnings when compiling without threads
Diffstat (limited to 'tests-clar/threads')
-rw-r--r--tests-clar/threads/refdb.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/tests-clar/threads/refdb.c b/tests-clar/threads/refdb.c
index 11e90a458..ffe437575 100644
--- a/tests-clar/threads/refdb.c
+++ b/tests-clar/threads/refdb.c
@@ -23,9 +23,7 @@ static void *iterate_refs(void *arg)
{
git_reference_iterator *i;
git_reference *ref;
- int count = 0, *id = arg;
-
- usleep(THREADS - *id);
+ int count = 0;
cl_git_pass(git_reference_iterator_new(&i, g_repo));
@@ -75,12 +73,19 @@ void test_threads_refdb__iterator(void)
for (t = 0; t < THREADS; ++t) {
id[t] = t;
+#ifdef GIT_THREADS
cl_git_pass(git_thread_create(&th[t], NULL, iterate_refs, &id[t]));
+#else
+ th[t] = t;
+ iterate_refs(&id[t]);
+#endif
}
+#ifdef GIT_THREADS
for (t = 0; t < THREADS; ++t) {
cl_git_pass(git_thread_join(th[t], NULL));
}
+#endif
memset(th, 0, sizeof(th));
}
@@ -124,7 +129,6 @@ static void *delete_refs(void *arg)
name, sizeof(name), "refs/heads/thread-%03d-%02d", (*id) & ~0x3, i);
if (!git_reference_lookup(&ref, g_repo, name)) {
- fprintf(stderr, "deleting %s\n", name);
cl_git_pass(git_reference_delete(ref));
git_reference_delete(ref);
}
@@ -180,9 +184,15 @@ void test_threads_refdb__edit_while_iterate(void)
}
id[t] = t;
+#ifdef GIT_THREADS
cl_git_pass(git_thread_create(&th[t], NULL, fn, &id[t]));
+#else
+ th[t] = t;
+ fn(&id[t]);
+#endif
}
+#ifdef GIT_THREADS
for (t = 0; t < THREADS; ++t) {
cl_git_pass(git_thread_join(th[t], NULL));
}
@@ -197,4 +207,5 @@ void test_threads_refdb__edit_while_iterate(void)
for (t = 0; t < THREADS; ++t) {
cl_git_pass(git_thread_join(th[t], NULL));
}
+#endif
}