summaryrefslogtreecommitdiff
path: root/libpthread/tests/test-12.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2010-08-01 02:00:19 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2010-08-01 02:00:19 +0200
commite54ae7d1bdfc689a0dc60438f7d3aa5cf68b4560 (patch)
tree6fba55f1c8392af93bdbbe8f54f51fd84e28cd03 /libpthread/tests/test-12.c
parent91beae771a8a09b59376f2f52212771c390ab14a (diff)
parentd3c289d5867fefd5340328b7bd8cec32ca726d92 (diff)
Merge commit 'upstream/20090404'
Diffstat (limited to 'libpthread/tests/test-12.c')
-rw-r--r--libpthread/tests/test-12.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/libpthread/tests/test-12.c b/libpthread/tests/test-12.c
new file mode 100644
index 00000000..2b784908
--- /dev/null
+++ b/libpthread/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;
+}