mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-22 11:21:00 +08:00
posix: Simplify pthread_attr_setstack()
Simplify * pthread_attr_setstack(), and * pthread_attr_setstacksize(). Update #2514.
This commit is contained in:
@@ -22,9 +22,6 @@
|
||||
|
||||
#if HAVE_DECL_PTHREAD_ATTR_SETSTACK
|
||||
|
||||
#include <rtems/posix/pthreadimpl.h>
|
||||
#include <rtems/score/stackimpl.h>
|
||||
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -37,11 +34,7 @@ int pthread_attr_setstack(
|
||||
if ( !attr || !attr->is_initialized )
|
||||
return EINVAL;
|
||||
|
||||
if (stacksize < PTHREAD_MINIMUM_STACK_SIZE)
|
||||
attr->stacksize = PTHREAD_MINIMUM_STACK_SIZE;
|
||||
else
|
||||
attr->stacksize = stacksize;
|
||||
|
||||
attr->stacksize = stacksize;
|
||||
attr->stackaddr = stackaddr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -20,9 +20,6 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <rtems/posix/pthreadimpl.h>
|
||||
#include <rtems/score/stackimpl.h>
|
||||
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -34,9 +31,6 @@ int pthread_attr_setstacksize(
|
||||
if ( !attr || !attr->is_initialized )
|
||||
return EINVAL;
|
||||
|
||||
if (stacksize < PTHREAD_MINIMUM_STACK_SIZE)
|
||||
attr->stacksize = PTHREAD_MINIMUM_STACK_SIZE;
|
||||
else
|
||||
attr->stacksize = stacksize;
|
||||
attr->stacksize = stacksize;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,10 @@ static int attribute_compare(
|
||||
attr1->stackaddr != attr2->stackaddr )
|
||||
return 1;
|
||||
|
||||
if ( attr1->stacksize != attr2->stacksize )
|
||||
if (
|
||||
attr1->stacksize != 0 &&
|
||||
attr2->stacksize != 0 &&
|
||||
attr1->stacksize != attr2->stacksize )
|
||||
return 1;
|
||||
|
||||
if ( attr1->contentionscope != attr2->contentionscope )
|
||||
|
||||
Reference in New Issue
Block a user