summaryrefslogtreecommitdiff
path: root/tests/test-12.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-12.c')
-rw-r--r--tests/test-12.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test-12.c b/tests/test-12.c
new file mode 100644
index 0000000..2b78490
--- /dev/null
+++ b/tests/test-12.c
@@ -0,0 +1,29 @@
+/* Test concurrency level. */
+
+#define _GNU_SOURCE
+
+#include <pthread.h>
+#include <assert.h>
+#include <error.h>
+#include <errno.h>
+
+int
+main (int argc, char **argv)
+{
+ int i;
+ int err;
+
+ i = pthread_getconcurrency ();
+ assert (i == 0);
+
+ err = pthread_setconcurrency (-1);
+ assert (err == EINVAL);
+
+ err = pthread_setconcurrency (4);
+ assert (err == 0);
+
+ i = pthread_getconcurrency ();
+ assert (i == 4);
+
+ return 0;
+}