summaryrefslogtreecommitdiffstats
path: root/cpukit/include
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-04-09 12:11:19 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-08-31 17:30:17 +0200
commitaedd92d1477df0025821b77c06b2f2b2dc7aaf67 (patch)
tree42c71c8c52678d2a986d53cc9a39e60e55e93251 /cpukit/include
parentscore: Move _Stack_Allocator_free to separate file (diff)
downloadrtems-aedd92d1477df0025821b77c06b2f2b2dc7aaf67.tar.bz2
score: Add stack free handler to TCB
This avoids a dependency to the stack free function in the thread destruction. Update #3959.
Diffstat (limited to 'cpukit/include')
-rw-r--r--cpukit/include/rtems/score/stackimpl.h7
-rw-r--r--cpukit/include/rtems/score/thread.h5
-rw-r--r--cpukit/include/rtems/score/threadimpl.h6
3 files changed, 13 insertions, 5 deletions
diff --git a/cpukit/include/rtems/score/stackimpl.h b/cpukit/include/rtems/score/stackimpl.h
index 305c4e4e51..df9f87d5a3 100644
--- a/cpukit/include/rtems/score/stackimpl.h
+++ b/cpukit/include/rtems/score/stackimpl.h
@@ -166,6 +166,13 @@ void *_Stack_Allocate( size_t stack_size );
*/
void _Stack_Free( void *stack_area );
+/**
+ * @brief This function does nothing.
+ *
+ * @param stack_area is not used.
+ */
+void _Stack_Free_nothing( void *stack_area );
+
/** @} */
#ifdef __cplusplus
diff --git a/cpukit/include/rtems/score/thread.h b/cpukit/include/rtems/score/thread.h
index ee0aee5b79..1daf6143f9 100644
--- a/cpukit/include/rtems/score/thread.h
+++ b/cpukit/include/rtems/score/thread.h
@@ -194,10 +194,9 @@ typedef struct {
/** This field is the initial priority. */
Priority_Control initial_priority;
/**
- * @brief This field is a pointer to the allocated stack area, otherwise it
- * is NULL.
+ * @brief This field points to the handler which should free the stack.
*/
- void *allocated_stack;
+ void ( *stack_free )( void * );
/** This field is the stack information. */
Stack_Control Initial_stack;
#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
diff --git a/cpukit/include/rtems/score/threadimpl.h b/cpukit/include/rtems/score/threadimpl.h
index 0b69caf962..61454eb7fe 100644
--- a/cpukit/include/rtems/score/threadimpl.h
+++ b/cpukit/include/rtems/score/threadimpl.h
@@ -144,9 +144,11 @@ typedef struct {
size_t stack_size;
/**
- * @brief The address of the allocated stack area or NULL.
+ * @brief This member contains the handler to free the stack.
+ *
+ * It shall not be NULL. Use _Stack_Free_nothing() if nothing is to free.
*/
- void *allocated_stack;
+ void ( *stack_free )( void * );
/**
* @brief The new thread's priority.