pthread_spawnattr_setrunmask_np()
Set the 64-bit runmask attribute in a spawn attributes object
Synopsis:
#include <spawn.h>
int pthread_spawnattr_setrunmask_np(
posix_spawnattr_t *attrp,
uint64_t runmask);
Arguments:
- attrp
- A pointer to the spawn attributes object that you want to modify.
- runmask
- The 64-bit runmask that you want to use for the spawned process.
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
The pthread_spawnattr_setrunmask_np() routine sets the 64-bit value of the runmask attribute in the given spawn attributes object. You must have already initialized this object by calling posix_spawnattr_init(). The runmask attribute determines the processor affinity of the initial thread in the spawned process and any further threads that it creates.
This setting takes effect only if the POSIX_SPAWN_EXPLICIT_CPU flag is set; to set this flag, call posix_spawnattr_setxflags().
This attribute is a bitmask representing the set of processors that the spawned process's threads
can run on. Processor numbering starts at 0, with each processor corresponding to a bit in the
runmask. For example, a runmask of 0x5 means the process's threads are
restricted to CPUs 0 and 2.
The default behavior is to allow the threads to run on any processor (i.e., no restrictions).
For more information, read the Processor affinity, clusters, runmasks, and inherit masks
discussion in the QNX OS Programmer's Guide.
To get the value of this attribute, call pthread_spawnattr_getrunmask_np().
For more information about spawn attributes, see the entry for posix_spawn().
Returns:
- EOK
- Success.
- EINVAL
- The attrp pointer does not refer to a valid attribute structure.
Classification:
Safety: | |
---|---|
Cancellation point | No |
Signal handler | Yes |
Thread | Yes |