PTHREAD_ATTR(3)

NAME
pthread_attr_init, pthread_attr_destroy, pthread_attr_setdetachstate, pthread_attr_getdetachstate, pthread_attr_setschedparam, pthread_attr_getschedparam - thread attribute operations

LIBRARY
libpthread

SYNOPSIS
#include <pthread.h>
int
pthread_attr_init(pthread_attr_t *attr);
int
pthread_attr_destroy(pthread_attr_t *attr);
int
pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate);
int
pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate);
int
pthread_attr_setschedparam(pthread_attr_t * restrict attr, const struct sched_param * restrict param);
int
pthread_attr_getschedparam(const pthread_attr_t * restrict attr, struct sched_param * restrict param);

DESCRIPTION
Thread attributes are used to specify parameters to pthread_create(). One attribute object can be used in multiple calls to pthread_create(), with or without modifications between calls.

The pthread_attr_init() function initializes attr with all the default thread attributes.

The pthread_attr_destroy() function destroys attr.

The pthread_attr_set*() functions set the attribute that corresponds to each function name.

The pthread_attr_get*() functions copy the value of the attribute that corresponds to each function name to the location pointed to by the second function parameter.

RETURN VALUES
If successful, these functions return 0. Otherwise, an error number is returned to indicate the error.

ERRORS
pthread_attr_init() shall fail if:

[ENOMEM]
    Out of memory.

pthread_attr_destroy() may fail if:

[EINVAL]
    The value specified by attr is invalid.

pthread_attr_setdetachstate() shall fail if:

[EINVAL]
    The value specified by detachstate is invalid.

pthread_attr_setschedparam() may fail if:

[EINVAL]
    The value specified by attr is invalid.

[ENOTSUP]
    The value specified by param is invalid.

SEE ALSO
pthread_create(3)

STANDARDS
pthread_attr_init(), pthread_attr_destroy(), pthread_attr_setdetachstate(), pthread_attr_getdetachstate(), pthread_attr_setschedparam(), and pthread_attr_getschedparam() conform to p1003.1-96.