---
name: "pthread_schedparam"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/pthread_getschedparam"
---

# pthread\_schedparam(3)

thread scheduling parameter manipulation

Part of [pthread\_getschedparam(3)](/pthread_getschedparam/3.md).

## NAME

**pthread\_setschedparam**, **pthread\_getschedparam** – thread scheduling parameter manipulation

## LIBRARY

POSIX Threads Library (libpthread, -lpthread)

## SYNOPSIS

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

## DESCRIPTION

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)](/sched_get_priority_min/2.md) and [sched\_get\_priority\_max(2)](/sched_get_priority_max/2.md) 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*.

## SEE ALSO

[sched\_get\_priority\_max(2)](/sched_get_priority_max/2.md), [sched\_get\_priority\_min(2)](/sched_get_priority_min/2.md)

## STANDARDS

The **pthread\_setschedparam**() and **pthread\_getschedparam**() functions conform to Version 2 of the Single UNIX Specification (“SUSv2”).
