summaryrefslogtreecommitdiff
path: root/rtkaio/tst-aiod3.c
diff options
context:
space:
mode:
Diffstat (limited to 'rtkaio/tst-aiod3.c')
-rw-r--r--rtkaio/tst-aiod3.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/rtkaio/tst-aiod3.c b/rtkaio/tst-aiod3.c
index 545a6d496c..aac04f3771 100644
--- a/rtkaio/tst-aiod3.c
+++ b/rtkaio/tst-aiod3.c
@@ -25,13 +25,19 @@
#include <errno.h>
#include "tst-aiod.h"
-int flag;
+
+static pthread_barrier_t b;
static void
thrfct (sigval_t arg)
{
- flag = 1;
+ int e = pthread_barrier_wait (&b);
+ if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+ {
+ puts ("child: barrier_wait failed");
+ exit (1);
+ }
}
@@ -53,6 +59,12 @@ do_test (int argc, char *argv[])
unlink (name);
+ if (pthread_barrier_init (&b, NULL, 2) != 0)
+ {
+ puts ("barrier_init failed");
+ return 1;
+ }
+
arr[0] = &cb;
void *p;
@@ -104,9 +116,10 @@ do_test (int argc, char *argv[])
return 1;
}
- if (flag != 0)
+ int e = pthread_barrier_wait (&b);
+ if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
{
- puts ("thread created, should not have happened");
+ puts ("parent: barrier_wait failed");
return 1;
}