mirror of
git://git.musl-libc.org/musl
synced 2024-12-16 03:35:06 +00:00
add stub versions of some missing optional pthread interfaces
priority inheritance is not yet supported, and priority protection probably will not be supported ever unless there's serious demand for it (it's a fairly heavy-weight feature). per-thread cpu clocks would be nice to have, but to my knowledge linux is still not capable of supporting them. glibc fakes them by using the _process_ cpu-time clock and subtracting the thread creation time, which gives seriously incorrect semantics (worse than not supporting the feature at all), so until there's a way to do it right, it will remain as a stub that always fails.
This commit is contained in:
parent
bb9abdef48
commit
5c6443ac42
@ -105,6 +105,9 @@ int pthread_mutex_timedlock(pthread_mutex_t *__restrict, const struct timespec *
|
||||
int pthread_mutex_destroy(pthread_mutex_t *);
|
||||
int pthread_mutex_consistent(pthread_mutex_t *);
|
||||
|
||||
int pthread_mutex_getprioceiling(const pthread_mutex_t *__restrict, int *__restrict);
|
||||
int pthread_mutex_setprioceiling(pthread_mutex_t *__restrict, int, int *__restrict);
|
||||
|
||||
int pthread_cond_init(pthread_cond_t *__restrict, const pthread_condattr_t *__restrict);
|
||||
int pthread_cond_destroy(pthread_cond_t *);
|
||||
int pthread_cond_wait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict);
|
||||
@ -192,6 +195,8 @@ int pthread_atfork(void (*)(void), void (*)(void), void (*)(void));
|
||||
int pthread_getconcurrency(void);
|
||||
int pthread_setconcurrency(int);
|
||||
|
||||
int pthread_getcpuclockid(pthread_t, clockid_t *);
|
||||
|
||||
struct __ptcb {
|
||||
void (*__f)(void *);
|
||||
void *__x;
|
||||
|
@ -68,6 +68,11 @@ int pthread_condattr_getpshared(const pthread_condattr_t *restrict a, int *restr
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *restrict a, int *restrict protocol)
|
||||
{
|
||||
*protocol = PTHREAD_PRIO_NONE;
|
||||
return 0;
|
||||
}
|
||||
int pthread_mutexattr_getpshared(const pthread_mutexattr_t *restrict a, int *restrict pshared)
|
||||
{
|
||||
*pshared = *a>>31;
|
||||
|
6
src/thread/pthread_getcpuclockid.c
Normal file
6
src/thread/pthread_getcpuclockid.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include "pthread_impl.h"
|
||||
|
||||
int pthread_getcpuclockid(pthread_t t, clockid_t *clockid)
|
||||
{
|
||||
return ENOSYS;
|
||||
}
|
6
src/thread/pthread_mutex_getprioceiling.c
Normal file
6
src/thread/pthread_mutex_getprioceiling.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include "pthread_impl.h"
|
||||
|
||||
int pthread_mutex_getprioceiling(const pthread_mutex_t *restrict m, int *restrict ceiling)
|
||||
{
|
||||
return EINVAL;
|
||||
}
|
6
src/thread/pthread_mutex_setprioceiling.c
Normal file
6
src/thread/pthread_mutex_setprioceiling.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include "pthread_impl.h"
|
||||
|
||||
int pthread_mutex_setprioceiling(pthread_mutex_t *restrict m, int ceiling, int *restrict old)
|
||||
{
|
||||
return EINVAL;
|
||||
}
|
7
src/thread/pthread_mutexattr_setprotocol.c
Normal file
7
src/thread/pthread_mutexattr_setprotocol.c
Normal file
@ -0,0 +1,7 @@
|
||||
#include "pthread_impl.h"
|
||||
|
||||
int pthread_mutexattr_setprotocol(pthread_mutexattr_t *a, int protocol)
|
||||
{
|
||||
if (protocol) return ENOTSUP;
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user