mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 10:46:25 +00:00
parent
f36bc80bd7
commit
86c1f65dfe
@ -214,6 +214,21 @@ extern "C" {
|
||||
}
|
||||
|
||||
|
||||
int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize)
|
||||
{
|
||||
if (!attr || !*attr)
|
||||
return EINVAL;
|
||||
|
||||
if (stacksize > (Thread::stack_virtual_size() - 4 * 4096) ||
|
||||
stacksize < 4096)
|
||||
return EINVAL;
|
||||
|
||||
(*attr)->stack_size = Genode::align_addr(stacksize, 12);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int pthread_attr_getstack(const pthread_attr_t *attr,
|
||||
void **stackaddr,
|
||||
::size_t *stacksize)
|
||||
|
@ -48,8 +48,9 @@ extern "C" {
|
||||
struct pthread_attr
|
||||
{
|
||||
pthread_t pthread;
|
||||
size_t stack_size;
|
||||
|
||||
pthread_attr() : pthread(0) { }
|
||||
pthread_attr() : pthread(0), stack_size(0) { }
|
||||
};
|
||||
|
||||
|
||||
|
@ -30,8 +30,11 @@ extern "C"
|
||||
/* cleanup threads which tried to self-destruct */
|
||||
pthread_cleanup();
|
||||
|
||||
size_t const stack_size = (attr && *attr && (*attr)->stack_size)
|
||||
? (*attr)->stack_size : STACK_SIZE;
|
||||
|
||||
pthread_t thread_obj = new pthread(attr ? *attr : 0, start_routine,
|
||||
arg, STACK_SIZE, "pthread", nullptr,
|
||||
arg, stack_size, "pthread", nullptr,
|
||||
Genode::Affinity::Location());
|
||||
|
||||
if (!thread_obj)
|
||||
|
Loading…
Reference in New Issue
Block a user