pthread_attr_destroy3
Thread attribute operations
Part of pthread_attr(3).
Usage
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
Library
POSIX Threads Library (libpthread, -lpthread)
Overview
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
The pthread_attr_init() function will fail if:
- [ENOMEM]
-
Out of memory.
The pthread_attr_destroy() function will fail if:
- [EINVAL]
-
Invalid value for attr.
The pthread_attr_setstacksize() and pthread_attr_setstack() functions will fail if:
- [EINVAL]
-
stacksize is less than PTHREAD_STACK_MIN.
The pthread_attr_setdetachstate() function will fail if:
- [EINVAL]
-
Invalid value for detachstate.
The pthread_attr_setinheritsched() function will fail if:
- [EINVAL]
-
Invalid value for attr.
The pthread_attr_setschedparam() function will fail if:
- [EINVAL]
-
Invalid value for attr.
- [ENOTSUP]
-
Invalid value for param.
The pthread_attr_setschedpolicy() function will fail if:
- [EINVAL]
-
Invalid value for attr.
- [ENOTSUP]
-
Invalid or unsupported value for policy.
The pthread_attr_setscope() function will fail if:
- [EINVAL]
-
Invalid value for attr.
- [ENOTSUP]
-
Invalid or unsupported value for contentionscope.
History
- FreeBSD 16.0-CURRENT (2026-10-27) to FreeBSD 13.3-RELEASE: the text shown here
- FreeBSD 13.2-RELEASE to FreeBSD 13.0-RELEASE
- FreeBSD 12.4-RELEASE
- FreeBSD 12.3-RELEASE
- FreeBSD 12.2-RELEASE
- FreeBSD 12.1-RELEASE
- FreeBSD 12.0-RELEASE
- FreeBSD 11.4-RELEASE
- FreeBSD 11.3-RELEASE
- FreeBSD 11.2-RELEASE
- FreeBSD 11.1-RELEASE
- FreeBSD 11.0-RELEASE
- FreeBSD 10.4-RELEASE
- FreeBSD 10.3-RELEASE
- FreeBSD 10.2-RELEASE
- FreeBSD 10.1-RELEASE
- FreeBSD 10.0-RELEASE
- FreeBSD 9.3-RELEASE
- FreeBSD 9.2-RELEASE
- FreeBSD 9.1-RELEASE
- FreeBSD 9.0-RELEASE
- FreeBSD 8.4-RELEASE
- FreeBSD 8.3-RELEASE
- FreeBSD 8.2-RELEASE
- FreeBSD 8.1-RELEASE
- FreeBSD 8.0-RELEASE
- FreeBSD 7.4-RELEASE
- FreeBSD 7.3-RELEASE
- FreeBSD 7.2-RELEASE
- FreeBSD 7.1-RELEASE
- FreeBSD 7.0-RELEASE
- FreeBSD 6.4-RELEASE
- FreeBSD 6.3-RELEASE to FreeBSD 5.3-RELEASE
- FreeBSD 5.2.1-RELEASE to FreeBSD 5.1-RELEASE
- FreeBSD 5.0-RELEASE
- FreeBSD 4.11-RELEASE to FreeBSD 4.8-RELEASE
- FreeBSD 4.7-RELEASE to FreeBSD 4.5-RELEASE
- FreeBSD 4.4-RELEASE
- FreeBSD 4.3-RELEASE
- FreeBSD 4.2-RELEASE to FreeBSD 4.1-RELEASE