tail head cat sleep
QR code linking to this page

Manual Pages  — SCHED_GETCPU

NAME

sched_getcpu – get current CPU

CONTENTS

LIBRARY

Standard C Library (libc, -lc)

SYNOPSIS

#include <sched.h>

int
sched_getcpu(void);

DESCRIPTION

The sched_getcpu() function returns the current CPU on which the calling thread is running.

RETURN VALUES

sched_getcpu() returns the 0-based index of the current CPU at the time of the call. The value may become invalid immediately after return, unless the thread is pinned to a specific CPU. CPU numbering is the same as used by cpuset(2) and CPU affinity calls.

There are no error values as sched_getcpu() does not fail.

SEE ALSO

cpuset(2), cpuset_getaffinity(2), cpuset_setaffinity(2), pthread_getaffinity_np(3), pthread_setaffinity_np

STANDARDS

The sched_getcpu function originated in Linux. This implementation aims to be source-compatible with the Linux implementation.

HISTORY

The sched_getcpu function was introduced in FreeBSD 13.1 .

SCHED_GETCPU (3) November 13, 2024

tail head cat sleep
QR code linking to this page


Please direct any comments about this manual page service to Ben Bullock. Privacy policy.