mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-22 11:34:09 +02:00
Add bindings to GNU sched_setaffinity' and
sched_getaffinity'.
* configure.ac: Add checks for `sched_setaffinity' and `sched_getaffinity'. * doc/ref/posix.texi (Processes): Document `getaffinity' and `setaffinity'. * libguile/posix.c (cpu_set_to_bitvector, scm_getaffinity)[HAVE_SCHED_GETAFFINITY]: New functions. (scm_setaffinity)[HAVE_SCHED_SETAFFINITY]: New function. * libguile/posix.h (scm_getaffinity, scm_setaffinity): New declarations. * test-suite/tests/posix.test ("affinity"): New test prefix.
This commit is contained in:
parent
50a4533f82
commit
fe613fe25d
5 changed files with 128 additions and 2 deletions
|
@ -1830,6 +1830,28 @@ the highest priority (lowest numerical value) of any of the
|
|||
specified processes.
|
||||
@end deffn
|
||||
|
||||
@cindex affinity, CPU
|
||||
|
||||
@deffn {Scheme Procedure} getaffinity pid
|
||||
@deffnx {C Function} scm_getaffinity (pid)
|
||||
Return a bitvector representing the CPU affinity mask for
|
||||
process @var{pid}. Each CPU the process has affinity with
|
||||
has its corresponding bit set in the returned bitvector.
|
||||
The number of bits set is a good estimate of how many CPUs
|
||||
Guile can use without stepping on other processes' toes.
|
||||
|
||||
Currently this procedure is only defined on GNU variants.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} setaffinity pid mask
|
||||
@deffnx {C Function} scm_setaffinity (pid, mask)
|
||||
Install the CPU affinity mask @var{mask}, a bitvector, for
|
||||
the process or thread with ID @var{pid}. The return value
|
||||
is unspecified.
|
||||
|
||||
Currently this procedure is only defined on GNU variants.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node Signals
|
||||
@subsection Signals
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue