pthread_getschedparam.c 437 B

123456789101112131415161718192021
  1. #include "pthread_impl.h"
  2. #include "lock.h"
  3. int pthread_getschedparam(pthread_t t, int *restrict policy, struct sched_param *restrict param)
  4. {
  5. int r;
  6. sigset_t set;
  7. __block_app_sigs(&set);
  8. LOCK(t->killlock);
  9. if (!t->tid) {
  10. r = ESRCH;
  11. } else {
  12. r = -__syscall(SYS_sched_getparam, t->tid, param);
  13. if (!r) {
  14. *policy = __syscall(SYS_sched_getscheduler, t->tid);
  15. }
  16. }
  17. UNLOCK(t->killlock);
  18. __restore_sigs(&set);
  19. return r;
  20. }