[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]


pthread_bind_to_cpu_np

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

Syntax

pthread_bind_to_cpu_np(
                       thread,  cpu_mask );
 


Argument Data Type Access

thread opaque pthread_t read cpu_mask unsigned long read


C Binding

int
pthread_bind_to_cpu_np (
pthread_t thread,
unsigned long cpu_mask);

Arguments

thread
Thread that will be bound to a CPU.
cpu_mask
Bit 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 thread or cpu_mask is invalid. -1 [ENOSYS] The function is not supported on this system.



[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]