Changeset View
Changeset View
Standalone View
Standalone View
head/lib/libthr/thread/thr_stack.c
Show First 20 Lines • Show All 284 Lines • ▼ Show 20 Lines | else { | ||||
attr->stackaddr_attr = stackaddr; | attr->stackaddr_attr = stackaddr; | ||||
} | } | ||||
if (attr->stackaddr_attr != NULL) | if (attr->stackaddr_attr != NULL) | ||||
return (0); | return (0); | ||||
else | else | ||||
return (-1); | return (-1); | ||||
} | } | ||||
/* | |||||
* Disable this warning from clang: | |||||
* | |||||
* cast from 'char *' to | |||||
* 'struct stack *' increases required alignment from 1 to 8 | |||||
* [-Werror,-Wcast-align] | |||||
* spare_stack = (struct stack *) | |||||
*/ | |||||
#ifdef __clang__ | |||||
#pragma GCC diagnostic push | |||||
#pragma GCC diagnostic ignored "-Wcast-align" | |||||
#endif | |||||
/* This function must be called with _thread_list_lock held. */ | /* This function must be called with _thread_list_lock held. */ | ||||
void | void | ||||
_thr_stack_free(struct pthread_attr *attr) | _thr_stack_free(struct pthread_attr *attr) | ||||
{ | { | ||||
struct stack *spare_stack; | struct stack *spare_stack; | ||||
if ((attr != NULL) && ((attr->flags & THR_STACK_USER) == 0) | if ((attr != NULL) && ((attr->flags & THR_STACK_USER) == 0) | ||||
&& (attr->stackaddr_attr != NULL)) { | && (attr->stackaddr_attr != NULL)) { | ||||
Show All 10 Lines | if (spare_stack->stacksize == THR_STACK_DEFAULT && | ||||
LIST_INSERT_HEAD(&dstackq, spare_stack, qe); | LIST_INSERT_HEAD(&dstackq, spare_stack, qe); | ||||
} else { | } else { | ||||
/* Non-default stack/guard size. */ | /* Non-default stack/guard size. */ | ||||
LIST_INSERT_HEAD(&mstackq, spare_stack, qe); | LIST_INSERT_HEAD(&mstackq, spare_stack, qe); | ||||
} | } | ||||
attr->stackaddr_attr = NULL; | attr->stackaddr_attr = NULL; | ||||
} | } | ||||
} | } | ||||
#ifdef __clang__ | |||||
#pragma GCC diagnostic pop | |||||
#endif |