pthread_getschedparam(3)

pthread_getschedparam3

Thread scheduling parameter manipulation

Part of pthread_schedparam(3).

Usage

#include <pthread.h>

int

pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param);

int

pthread_getschedparam(pthread_t thread, int *restrict policy, struct sched_param *restrict param);

Library

POSIX Threads Library (libpthread, -lpthread)

Overview

The pthread_setschedparam() and pthread_getschedparam() functions set and get the scheduling parameters of individual threads. The scheduling policy for a thread can either be SCHED_FIFO (first in, first out), SCHED_RR (round-robin), or SCHED_OTHER (timesharing). Valid thread priorities (accessed via param->sched_priority) must be within the range returned by the sched_get_priority_min(2) and sched_get_priority_max(2) system calls.

Return values

If successful, these functions return 0. Otherwise, an error number is returned to indicate the error.

Errors

The pthread_setschedparam() function will fail if:

[EINVAL]

Invalid value for policy.

[ENOTSUP]

Invalid value for scheduling parameters.

[EPERM]

The calling thread does not have sufficient privilege to perform the operation.

[ESRCH]

Non-existent thread thread.

The pthread_getschedparam() function will fail if:

[ESRCH]

Non-existent thread thread.

Releases

69 releases since FreeBSD 4.1-RELEASE; the text changed 39 times.

  1. 4.1–4.3
  2. 4.4
  3. 4.5–4.11
  4. 5.0
  5. 5.1–5.2.1
  6. 5.3–6.1
  7. 6.2–6.3
  8. 6.4
  9. 7.0
  10. 7.1
  11. 7.2
  12. 7.3
  13. 7.4
  14. 8.0
  15. 8.1
  16. 8.2
  17. 8.3
  18. 8.4
  19. 9.0
  20. 9.1
  21. 9.2
  22. 9.3
  23. 10.0
  24. 10.1
  25. 10.2
  26. 10.3
  27. 10.4
  28. 11.0
  29. 11.1
  30. 11.2
  31. 11.3
  32. 11.4
  33. 12.0
  34. 12.1
  35. 12.2
  36. 12.3
  37. 12.4
  38. 13.0–13.1
  39. 13.2
  40. 13.3–16.0

Standards

The pthread_setschedparam() and pthread_getschedparam() functions conform to Version 2 of the Single UNIX Specification (“SUSv2”).

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.