summaryrefslogtreecommitdiff
path: root/src/libstrongswan/tests/suites/test_threading.c
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2014-07-11 07:23:31 +0200
committerYves-Alexis Perez <corsac@debian.org>2014-07-11 07:23:31 +0200
commit81c63b0eed39432878f78727f60a1e7499645199 (patch)
tree82387d8fecd1c20788fd8bd784a9b0bde091fb6b /src/libstrongswan/tests/suites/test_threading.c
parentc5ebfc7b9c16551fe825dc1d79c3f7e2f096f6c9 (diff)
downloadvyos-strongswan-81c63b0eed39432878f78727f60a1e7499645199.tar.gz
vyos-strongswan-81c63b0eed39432878f78727f60a1e7499645199.zip
Imported Upstream version 5.2.0
Diffstat (limited to 'src/libstrongswan/tests/suites/test_threading.c')
-rw-r--r--src/libstrongswan/tests/suites/test_threading.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libstrongswan/tests/suites/test_threading.c b/src/libstrongswan/tests/suites/test_threading.c
index 844959e46..0526d9d6e 100644
--- a/src/libstrongswan/tests/suites/test_threading.c
+++ b/src/libstrongswan/tests/suites/test_threading.c
@@ -16,7 +16,6 @@
#include "test_suite.h"
-#include <sched.h>
#include <unistd.h>
#include <threading/thread.h>
@@ -1215,6 +1214,8 @@ static void *cleanup_cancel_run(void *data)
{
thread_cancelability(FALSE);
+ barrier_wait(barrier);
+
thread_cleanup_push(cleanup3, data);
thread_cleanup_push(cleanup2, data);
thread_cleanup_push(cleanup1, data);
@@ -1234,11 +1235,13 @@ START_TEST(test_cleanup_cancel)
uintptr_t values[THREADS];
int i;
+ barrier = barrier_create(THREADS+1);
for (i = 0; i < THREADS; i++)
{
values[i] = 1;
threads[i] = thread_create(cleanup_cancel_run, &values[i]);
}
+ barrier_wait(barrier);
for (i = 0; i < THREADS; i++)
{
threads[i]->cancel(threads[i]);
@@ -1248,6 +1251,7 @@ START_TEST(test_cleanup_cancel)
threads[i]->join(threads[i]);
ck_assert_int_eq(values[i], 4);
}
+ barrier_destroy(barrier);
}
END_TEST