mirror of
https://sourceware.org/git/glibc.git
synced 2025-06-06 11:41:02 +03:00
support: Add support_small_thread_stack_size
It returns the minimum stack size large enough to cover most internal glibc stack usage.
This commit is contained in:
parent
c6e0b0b5b0
commit
ecdb06cdf2
@ -20,8 +20,8 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <support/xthread.h>
|
#include <support/xthread.h>
|
||||||
|
|
||||||
void
|
size_t
|
||||||
support_set_small_thread_stack_size (pthread_attr_t *attr)
|
support_small_thread_stack_size (void)
|
||||||
{
|
{
|
||||||
/* Some architectures have too small values for PTHREAD_STACK_MIN
|
/* Some architectures have too small values for PTHREAD_STACK_MIN
|
||||||
which cannot be used for creating threads. Ensure that the stack
|
which cannot be used for creating threads. Ensure that the stack
|
||||||
@ -31,5 +31,11 @@ support_set_small_thread_stack_size (pthread_attr_t *attr)
|
|||||||
if (stack_size < PTHREAD_STACK_MIN)
|
if (stack_size < PTHREAD_STACK_MIN)
|
||||||
stack_size = PTHREAD_STACK_MIN;
|
stack_size = PTHREAD_STACK_MIN;
|
||||||
#endif
|
#endif
|
||||||
xpthread_attr_setstacksize (attr, stack_size);
|
return stack_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
support_set_small_thread_stack_size (pthread_attr_t *attr)
|
||||||
|
{
|
||||||
|
xpthread_attr_setstacksize (attr, support_small_thread_stack_size ());
|
||||||
}
|
}
|
||||||
|
@ -75,6 +75,8 @@ void xpthread_attr_setstacksize (pthread_attr_t *attr,
|
|||||||
void xpthread_attr_setguardsize (pthread_attr_t *attr,
|
void xpthread_attr_setguardsize (pthread_attr_t *attr,
|
||||||
size_t guardsize);
|
size_t guardsize);
|
||||||
|
|
||||||
|
/* Return the stack size used on support_set_small_thread_stack_size. */
|
||||||
|
size_t support_small_thread_stack_size (void);
|
||||||
/* Set the stack size in ATTR to a small value, but still large enough
|
/* Set the stack size in ATTR to a small value, but still large enough
|
||||||
to cover most internal glibc stack usage. */
|
to cover most internal glibc stack usage. */
|
||||||
void support_set_small_thread_stack_size (pthread_attr_t *attr);
|
void support_set_small_thread_stack_size (pthread_attr_t *attr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user