implement pthread_[sg]etconcurrency.
authorRich Felker <dalias@aerifal.cx>
Mon, 30 May 2011 15:31:07 +0000 (11:31 -0400)
committerRich Felker <dalias@aerifal.cx>
Mon, 30 May 2011 15:31:07 +0000 (11:31 -0400)
there is a resource limit of 0 bits to store the concurrency level
requested. thus any positive level exceeds a resource limit, resulting
in EAGAIN. :-)

include/pthread.h
src/thread/pthread_getconcurrency.c [new file with mode: 0644]
src/thread/pthread_setconcurrency.c [new file with mode: 0644]

index 43754dd..5d97ebf 100644 (file)
@@ -178,6 +178,9 @@ int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int);
 
 int pthread_atfork(void (*)(void), void (*)(void), void (*)(void));
 
+int pthread_getconcurrency(void);
+int pthread_setconcurrency(int);
+
 #include <bits/pthread.h>
 
 int __setjmp(void *);
diff --git a/src/thread/pthread_getconcurrency.c b/src/thread/pthread_getconcurrency.c
new file mode 100644 (file)
index 0000000..269429a
--- /dev/null
@@ -0,0 +1,6 @@
+#include <pthread.h>
+
+int pthread_getconcurrency()
+{
+       return 0;
+}
diff --git a/src/thread/pthread_setconcurrency.c b/src/thread/pthread_setconcurrency.c
new file mode 100644 (file)
index 0000000..091abf9
--- /dev/null
@@ -0,0 +1,9 @@
+#include <pthread.h>
+#include <errno.h>
+
+int pthread_setconcurrency(int val)
+{
+       if (val < 0) return EINVAL;
+       if (val > 0) return EAGAIN;
+       return 0;
+}