diff --git a/headers/posix/pthread.h b/headers/posix/pthread.h index 5ab2ad5e95..d9c52d5941 100644 --- a/headers/posix/pthread.h +++ b/headers/posix/pthread.h @@ -163,6 +163,8 @@ extern void pthread_exit(void *value_ptr); extern int pthread_join(pthread_t thread, void **_value); extern pthread_t pthread_self(void); extern int pthread_kill(pthread_t thread, int sig); +extern int pthread_getconcurrency(void); +extern int pthread_setconcurrency(int newLevel); extern int pthread_cancel(pthread_t thread); extern int pthread_setcancelstate(int state, int *_oldState); diff --git a/src/system/libroot/posix/pthread/pthread.c b/src/system/libroot/posix/pthread/pthread.c index 2a711b5f12..f4822c26a3 100644 --- a/src/system/libroot/posix/pthread/pthread.c +++ b/src/system/libroot/posix/pthread/pthread.c @@ -19,6 +19,7 @@ static const pthread_attr pthread_attr_default = { static int32 sPthreadSlot = -1; +static int sConcurrencyLevel; struct pthread_thread * @@ -157,3 +158,20 @@ pthread_detach(pthread_t thread) return 0; } + +int +pthread_getconcurrency(void) +{ + return sConcurrencyLevel; +} + + +int +pthread_setconcurrency(int newLevel) +{ + if (newLevel < 0) + return EINVAL; + + sConcurrencyLevel = newLevel; + return 0; +}