pthread_threading_attr.h¶
Thread creation features (attributes).
Note
Do not include this header file directly, but pthread.h.
-
PTHREAD_CREATE_JOINABLE
¶ Create new pthread as joinable (default).
1
(0)
-
PTHREAD_CREATE_DETACHED
¶ Create new pthread in detached state.
1
(1)
-
int
pthread_attr_init
(pthread_attr_t * attr)¶ Initialize attributes for a new pthread.
See also
pthread_threading.h::pthread_create()
attr
is initialized.Parameters
attr: Structure to initialize Return values
- 0, invocation cannot fail
-
int
pthread_attr_destroy
(pthread_attr_t * attr)¶ Destroys an attribute set.
Since pthread_attr_t does not hold dynamic data, this is a no-op.
Return values
- 0, since this a no-op that cannot fail
-
int
pthread_attr_getdetachstate
(const pthread_attr_t * attr, int * detachstate)¶ Tells whether to create a new pthread in a detached state.
Parameters
attr: Attribute set to query. detachstate: Either PTHREAD_CREATE_JOINABLE or PTHREAD_CREATE_DETACHED. Return values
- 0, the invocation cannot fail
-
int
pthread_attr_setdetachstate
(pthread_attr_t * attr, int detachstate)¶ Sets whether to create a new pthread in a detached state.
Note
Supplying a value different form PTHREAD_CREATE_JOINABLE or PTHREAD_CREATE_DETACHED causes undefined behavior.
Parameters
attr: Attribute set to operate on. detachstate: Either PTHREAD_CREATE_JOINABLE or PTHREAD_CREATE_DETACHED. Return values
0
on success.-1
if you managed to supply an illegal value indetachstate
.
-
int
pthread_attr_getguardsize
(const pthread_attr_t * attr,msp430_types.h::size_t
* guardsize)¶ This function is unused right now, and only exists for POSIX compatibility.
Parameters
attr: Unused guardsize: Unused Return values
- -1, this function fails
-
int
pthread_attr_setguardsize
(pthread_attr_t * attr,msp430_types.h::size_t
guardsize)¶ This function is unused right now, and only exists for POSIX compatibility.
Parameters
attr: Unused guardsize: Unused Return values
- -1, this function fails
-
int
pthread_attr_getschedparam
(const pthread_attr_t * attr, struct sched_param * param)¶ This function is unused right now, and only exists for POSIX compatibility.
Parameters
attr: Unused param: Unused Return values
- -1, this function fails
-
int
pthread_attr_setschedparam
(pthread_attr_t * attr, const struct sched_param * param)¶ This function is unused right now, and only exists for POSIX compatibility.
Parameters
attr: Unused param: Unused Return values
- -1, this function fails
-
int
pthread_attr_getschedpolicy
(const pthread_attr_t * attr, int * policy)¶ This function is unused right now, and only exists for POSIX compatibility.
Parameters
attr: Unused policy: Unused Return values
- -1, this function fails
-
int
pthread_attr_setschedpolicy
(pthread_attr_t * attr, int policy)¶ This function is unused right now, and only exists for POSIX compatibility.
Parameters
attr: Unused policy: Unused Return values
- -1, this function fails
-
int
pthread_attr_getinheritsched
(const pthread_attr_t * attr, int * inherit)¶ This function is unused right now, and only exists for POSIX compatibility.
Parameters
attr: Unused inherit: Unused Return values
- -1, this function fails
-
int
pthread_attr_setinheritsched
(pthread_attr_t * attr, int inherit)¶ This function is unused right now, and only exists for POSIX compatibility.
Parameters
attr: Unused inherit: Unused Return values
- -1, this function fails
-
int
pthread_attr_getscope
(const pthread_attr_t * attr, int * scope)¶ This function is unused right now, and only exists for POSIX compatibility.
Parameters
attr: Unused scope: Unused Return values
- -1, this function fails
-
int
pthread_attr_setscope
(pthread_attr_t * attr, int scope)¶ This function is unused right now, and only exists for POSIX compatibility.
Parameters
attr: Unused scope: Unused Return values
- -1, this function fails
-
int
pthread_attr_getstackaddr
(const pthread_attr_t * attr, void ** stackaddr)¶ Query assigned stack for new pthread.
See also
pthread_threading_attr.h::pthread_attr_setstackaddr()
for more informationParameters
attr: Attribute set to query stackaddr: Pointer to previously assigned stack, or NULL
for dynamic allocation.Return values
- 0, this invocation cannot fail
-
int
pthread_attr_setstackaddr
(pthread_attr_t * attr, void * stackaddr)¶ Set address of the stack to use for the new pthread.
If
*stackaddr == NULL
, then the stack is dynamically allocated withmalloc.h::malloc()
. No two running threads may operate on the same stack. The stack of a zombie thread (i.e. a non-detached thread that exited but was not yet joined) may in theory be reused even before joining, though there might be problems if the stack was preempted beforepthread_threading.h::pthread_exit()
completed.Parameters
attr: Attribute set to operate on. stackaddr: Static stack to use, or NULL
for dynamic allocation.Return values
- 0, this invocation cannot fail
-
int
pthread_attr_getstacksize
(const pthread_attr_t * attr,msp430_types.h::size_t
* stacksize)¶ Query set stacksize for new pthread.
Returns default stack size of the value is yet unset.
Parameters
attr: Attribute set to query. stacksize: Assigned or default stack size, resp. Return values
- 0, this invocation cannot fail
-
int
pthread_attr_setstacksize
(pthread_attr_t * attr,msp430_types.h::size_t
stacksize)¶ Set the stack size for the new pthread.
If you use
pthread_threading_attr.h::pthread_attr_getstackaddr()
to assign a static stack, then you must use this function to set the size of the stack. In case of dynamic memory allocation this overrules the default value.Parameters
attr: Attribute set to operate on stacksize: Size of the stack of the new thread. Supply 0
to use the default value.Return values
- 0, this invocation cannot fail.
-
struct
pthread_attr_t
¶ An attribute set to supply to
pthread_threading.h::pthread_create()
A zeroed out datum is default initiliazed.
See also
pthread_threading.h::pthread_create()
for further information-
uint8_t
detached
¶ Start in detached state.
-
char *
ss_sp
¶ Stack to use for new thread.
-
msp430_types.h::size_t
ss_size
¶ Size of dynamically allocated stack, or supplied stack, resp.
-
uint8_t