Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

pthread_bind_to_cpu_np(3)  —  Subroutines

NAME

pthread_bind_to_cpu_np − Binds a thread to a particular CPU on a multiprocessor system. 

SYNOPSIS

#include <pthread.h>
int pthread_bind_to_cpu_np(

pthread_t ∗thread ,
unsigned long ∗cpu_mask );

PARAMETERS

threadThread that will be bound to a CPU. 

cpu_maskBit mask specifying which CPU the thread is to be bound to.  The low-order bit represents the first CPU.  Only one bit in this mask may be set. 

DESCRIPTION

This routine binds a thread to a particular processor on a multiprocessor system.  Once bound, a thread will only run on the specified CPU until the thread terminates, or the binding is changed. 

Specify a cpu_mask of 0 to allow a previously bound thread to execute on any available CPU. 

This routine is not available on all platforms.  If it is not available, pthread_bind_to_cpu_np returns −1 and sets errno to ENOSYS. 

RETURN VALUES

If an error condition occurs, this routine returns −1 and sets errno to the corresponding error value. Possible return values are as follows:

Return Error Description
 0 Successful completion.
−1 [EINVAL] The value specified by cond, mutex, or abstime is invalid. 
Different mutexes are supplied for concurrent pthread_bind_to_cpu_np operations or pthread_cond_wait operations on the same condition variable. 
−1 [EINVAL] The value specified by thread or cpu_mask is invalid. 
−1 [ENOSYS] The function is not supported on this system.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026