---
name: "PR_SET_TIMERSLACK"
section: "2const"
platform: "linux"
package: "man-pages"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/PR_SET_TIMERSLACK"
---

# PR\_SET\_TIMERSLACK(2const)

set the "current" timer slack value for the calling thread

## NAME

PR\_SET\_TIMERSLACK - set the "current" timer slack value for the calling thread

## LIBRARY

Standard C library (*libc*, *-lc*)

## SYNOPSIS

```
#include <linux/prctl.h>  /* Definition of PR_* constants */
#include <sys/prctl.h>
```

**int prctl(PR\_SET\_TIMERSLACK, unsigned long** *slack***);**

## DESCRIPTION

Each thread has two associated timer slack values: a "default" value, and a "current" value. This operation sets the "current" timer slack value for the calling thread. *slack* is an unsigned long value in the range \[**1L**, **ULONG\_MAX**\]. If the nanosecond value supplied in *slack* is greater than zero, then the "current" value is set to this value. If *slack* is **0L**, the "current" timer slack is reset to the thread's "default" timer slack value.

The "current" timer slack is used by the kernel to group timer expirations for the calling thread that are close to one another; as a consequence, timer expirations for the thread may be up to the specified number of nanoseconds late (but will never expire early). Grouping timer expirations can help reduce system power consumption by minimizing CPU wake-ups.

The timer expirations affected by timer slack are those set by [**select**(2)](/select/2.md), [**pselect**(2)](/pselect/2.md), [**poll**(2)](/poll/2.md), [**ppoll**(2)](/ppoll/2.md), [**epoll\_wait**(2)](/epoll_wait/2.md), [**epoll\_pwait**(2)](/epoll_pwait/2.md), [**clock\_nanosleep**(2)](/clock_nanosleep/2.md), [**nanosleep**(2)](/nanosleep/2.md), and [**futex**(2)](/futex/2.md) (and thus the library functions implemented via futexes, including [**pthread\_cond\_timedwait**(3)](/pthread_cond_timedwait/3.md), [**pthread\_mutex\_timedlock**(3)](/pthread_mutex_timedlock/3.md), [**pthread\_rwlock\_timedrdlock**(3)](/pthread_rwlock_timedrdlock/3.md), [**pthread\_rwlock\_timedwrlock**(3)](/pthread_rwlock_timedwrlock/3.md), and [**sem\_timedwait**(3)](/sem_timedwait/3.md)).

Timer slack is not applied to threads that are scheduled under a real-time scheduling policy (see [**sched\_setscheduler**(2)](/sched_setscheduler/2.md)).

When a new thread is created, the two timer slack values are made the same as the "current" value of the creating thread. Thereafter, a thread can adjust its "current" timer slack value via **PR\_SET\_TIMERSLACK**. The "default" value can't be changed. The timer slack values of [**init**(1)](/init/1.md) (PID 1), the ancestor of all processes, are 50,000 nanoseconds (50 microseconds). The timer slack value is inherited by a child created via [**fork**(2)](/fork/2.md), and is preserved across [**execve**(2)](/execve/2.md).

## RETURN VALUE

On success, 0 is returned. On error, -1 is returned, and *errno* is set to indicate the error.

## STANDARDS

Linux.

## HISTORY

Linux 2.6.28.

## SEE ALSO

[**prctl**(2)](/prctl/2.md), [**PR\_GET\_TIMERSLACK**(2const)](/PR_GET_TIMERSLACK/2const.md), [**proc\_pid\_timerslack\_ns**(5)](/proc_pid_timerslack_ns/5.md)
