Selaa lähdekoodia

implement pthread_[sg]etconcurrency.

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. :-)
Rich Felker 13 vuotta sitten
vanhempi
sitoutus
ddd87b2f10
3 muutettua tiedostoa jossa 18 lisäystä ja 0 poistoa
  1. 3 0
      include/pthread.h
  2. 6 0
      src/thread/pthread_getconcurrency.c
  3. 9 0
      src/thread/pthread_setconcurrency.c

+ 3 - 0
include/pthread.h

@@ -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 *);

+ 6 - 0
src/thread/pthread_getconcurrency.c

@@ -0,0 +1,6 @@
+#include <pthread.h>
+
+int pthread_getconcurrency()
+{
+	return 0;
+}

+ 9 - 0
src/thread/pthread_setconcurrency.c

@@ -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;
+}