Function: num-processors

num-processors is a function defined in process.c.

Signature

(num-processors &optional QUERY)

Documentation

Return the number of processors, a positive integer.

Each usable thread execution unit counts as a processor. By default, count the number of available processors, overridable via the OMP_NUM_THREADS environment variable. If optional argument QUERY is current, ignore OMP_NUM_THREADS. If QUERY is all, also count processors not available.

Probably introduced at or before Emacs version 28.1.

Source Code

// Defined in /usr/src/emacs/src/process.c
{
#ifndef MSDOS
  return make_uint (num_processors (EQ (query, Qall) ? NPROC_ALL
				    : EQ (query, Qcurrent) ? NPROC_CURRENT
				    : NPROC_CURRENT_OVERRIDABLE));
#else
  return make_fixnum (1);
#endif
}