pthread_attr(3) - NetBSD Manual Pages

Command: Section: Arch: Collection:  
PTHREAD_ATTR(3)         NetBSD Library Functions Manual        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
POSIX Threads Library (libpthread, -lpthread)
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 sec- ond function parameter. The attribute parameters for the pthread_attr_setdetachstate() and pthread_attr_getdetachstate() are mutually exclusive and must be one of: PTHREAD_CREATE_JOINABLE The threads must explicitly be waited for using the pthread_join() function once they exit for their status to be received and their resources to be freed. This is the default. PTHREAD_CREATE_DETACHED The thread's resources will automatically be freed once the thread exits, and the thread will not be joined.
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), pthread_join(3)
STANDARDS
pthread_attr_init(), pthread_attr_destroy(), pthread_attr_setdetachstate(), pthread_attr_getdetachstate(), pthread_attr_setschedparam(), and pthread_attr_getschedparam() conform to ISO/IEC 9945-1:1996 (``POSIX.1''). NetBSD 5.0.1 March 21, 2007 NetBSD 5.0.1
Powered by man-cgi (2024-03-20). Maintained for NetBSD by Kimmo Suominen. Based on man-cgi by Panagiotis Christias.