Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
SCHED_GETCPU(3)		    Library Functions Manual	       SCHED_GETCPU(3)

NAME
       sched_getcpu -- get current CPU

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 call-
       ing 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.

FreeBSD	15.0		       November	13, 2024	       SCHED_GETCPU(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=sched_getcpu&manpath=FreeBSD+15.0-RELEASE+and+Ports.quarterly>

home | help