forked from Imagelibrary/rtems
CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE
Make CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE configurable by the user. Update #3434.
This commit is contained in:
@@ -1165,8 +1165,10 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
|
|||||||
* This specifies the default POSIX thread stack size. By default, it is
|
* This specifies the default POSIX thread stack size. By default, it is
|
||||||
* twice that recommended for the port.
|
* twice that recommended for the port.
|
||||||
*/
|
*/
|
||||||
|
#ifndef CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE
|
||||||
#define CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE \
|
#define CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE \
|
||||||
(2 * CONFIGURE_MINIMUM_TASK_STACK_SIZE)
|
(2 * CONFIGURE_MINIMUM_TASK_STACK_SIZE)
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Idle task stack size configuration.
|
* @brief Idle task stack size configuration.
|
||||||
@@ -3050,6 +3052,9 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
|
|||||||
CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE,
|
CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE,
|
||||||
CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME
|
CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const size_t _Configuration_POSIX_Minimum_stack_size =
|
||||||
|
CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
/**@{**/
|
/**@{**/
|
||||||
|
|
||||||
|
extern const size_t _Configuration_POSIX_Minimum_stack_size;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief POSIX threads initialize user threads body.
|
* @brief POSIX threads initialize user threads body.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ extern "C" {
|
|||||||
/**
|
/**
|
||||||
* The following sets the minimum stack size for POSIX threads.
|
* The following sets the minimum stack size for POSIX threads.
|
||||||
*/
|
*/
|
||||||
#define PTHREAD_MINIMUM_STACK_SIZE (_Stack_Minimum() * 2)
|
#define PTHREAD_MINIMUM_STACK_SIZE _Configuration_POSIX_Minimum_stack_size
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The following defines the information control block used to manage
|
* The following defines the information control block used to manage
|
||||||
|
|||||||
@@ -25,6 +25,8 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
|
||||||
#include <rtems/test.h>
|
#include <rtems/test.h>
|
||||||
#include <tmacros.h>
|
#include <tmacros.h>
|
||||||
|
|
||||||
@@ -65,6 +67,8 @@ const char rtems_test_name[] = "PSXCONFIG 1";
|
|||||||
#define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 41
|
#define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 41
|
||||||
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
|
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
|
||||||
|
|
||||||
|
#define CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE CPU_STACK_MINIMUM_SIZE
|
||||||
|
|
||||||
#define CONFIGURE_MAXIMUM_POSIX_THREADS 3
|
#define CONFIGURE_MAXIMUM_POSIX_THREADS 3
|
||||||
#define CONFIGURE_MAXIMUM_POSIX_TIMERS 47
|
#define CONFIGURE_MAXIMUM_POSIX_TIMERS 47
|
||||||
|
|
||||||
@@ -462,8 +466,21 @@ static rtems_task Init(rtems_task_argument argument)
|
|||||||
#ifdef CONFIGURE_MAXIMUM_POSIX_THREADS
|
#ifdef CONFIGURE_MAXIMUM_POSIX_THREADS
|
||||||
for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_THREADS; ++i) {
|
for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_THREADS; ++i) {
|
||||||
pthread_t thread;
|
pthread_t thread;
|
||||||
|
pthread_attr_t attr;
|
||||||
|
size_t stack_size;
|
||||||
|
|
||||||
eno = pthread_create(&thread, NULL, posix_thread, NULL);
|
eno = pthread_create(&thread, NULL, posix_thread, NULL);
|
||||||
rtems_test_assert(eno == 0);
|
rtems_test_assert(eno == 0);
|
||||||
|
|
||||||
|
eno = pthread_getattr_np(thread, &attr);
|
||||||
|
rtems_test_assert(eno == 0);
|
||||||
|
|
||||||
|
eno = pthread_attr_getstacksize(&attr, &stack_size);
|
||||||
|
rtems_test_assert(eno == 0);
|
||||||
|
rtems_test_assert(stack_size == CPU_STACK_MINIMUM_SIZE);
|
||||||
|
|
||||||
|
eno = pthread_attr_destroy(&attr);
|
||||||
|
rtems_test_assert(eno == 0);
|
||||||
}
|
}
|
||||||
rtems_resource_snapshot_take(&snapshot);
|
rtems_resource_snapshot_take(&snapshot);
|
||||||
rtems_test_assert(
|
rtems_test_assert(
|
||||||
|
|||||||
Reference in New Issue
Block a user