summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-03 07:38:19 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-04 07:24:30 +0200
commit1d40d81b4b8dd50e4162b0b79b60d3312d2744e5 (patch)
tree9c7dc074ea705a924742d965dcd22afef579cb5b /cpukit/rtems
parentbsp/mvme5500: Use thread local variable (diff)
downloadrtems-1d40d81b4b8dd50e4162b0b79b60d3312d2744e5.tar.bz2
rtems: Remove task variables
Update #2494. Update #2555.
Diffstat (limited to 'cpukit/rtems')
-rw-r--r--cpukit/rtems/Makefile.am7
-rw-r--r--cpukit/rtems/include/rtems/rtems/tasks.h46
-rw-r--r--cpukit/rtems/include/rtems/rtems/tasksimpl.h15
-rw-r--r--cpukit/rtems/mainpage.h38
-rw-r--r--cpukit/rtems/src/tasks.c92
-rw-r--r--cpukit/rtems/src/taskvariable_invoke_dtor.c52
-rw-r--r--cpukit/rtems/src/taskvariableadd.c97
-rw-r--r--cpukit/rtems/src/taskvariabledelete.c86
-rw-r--r--cpukit/rtems/src/taskvariableget.c88
9 files changed, 9 insertions, 512 deletions
diff --git a/cpukit/rtems/Makefile.am b/cpukit/rtems/Makefile.am
index 6515a08449..73d9e307ca 100644
--- a/cpukit/rtems/Makefile.am
+++ b/cpukit/rtems/Makefile.am
@@ -104,13 +104,6 @@ librtems_a_SOURCES += src/taskstart.c
librtems_a_SOURCES += src/tasksuspend.c
librtems_a_SOURCES += src/taskwakeafter.c
librtems_a_SOURCES += src/taskwakewhen.c
-if HAS_SMP
-else
-librtems_a_SOURCES += src/taskvariableadd.c
-librtems_a_SOURCES += src/taskvariabledelete.c
-librtems_a_SOURCES += src/taskvariableget.c
-librtems_a_SOURCES += src/taskvariable_invoke_dtor.c
-endif
librtems_a_SOURCES += src/schedulergetprocessorset.c
librtems_a_SOURCES += src/schedulerident.c
diff --git a/cpukit/rtems/include/rtems/rtems/tasks.h b/cpukit/rtems/include/rtems/rtems/tasks.h
index 11e2780b9e..5f33e0b04b 100644
--- a/cpukit/rtems/include/rtems/rtems/tasks.h
+++ b/cpukit/rtems/include/rtems/rtems/tasks.h
@@ -372,52 +372,6 @@ rtems_status_code rtems_task_is_suspended(
rtems_id id
);
-#if !defined(RTEMS_SMP)
-/**
- * @brief RTEMS Add Task Variable
- *
- * @deprecated Task variables are deprecated.
- *
- * This directive adds a per task variable.
- *
- * @note This service is not available in SMP configurations.
- */
-rtems_status_code rtems_task_variable_add(
- rtems_id tid,
- void **ptr,
- void (*dtor)(void *)
-) RTEMS_DEPRECATED;
-
-/**
- * @brief Get a per-task variable
- *
- * @deprecated Task variables are deprecated.
- *
- * This directive gets the value of a task variable.
- *
- * @note This service is not available in SMP configurations.
- */
-rtems_status_code rtems_task_variable_get(
- rtems_id tid,
- void **ptr,
- void **result
-) RTEMS_DEPRECATED;
-
-/**
- * @brief RTEMS Delete Task Variable
- *
- * @deprecated Task variables are deprecated.
- *
- * This directive removes a per task variable.
- *
- * @note This service is not available in SMP configurations.
- */
-rtems_status_code rtems_task_variable_delete(
- rtems_id tid,
- void **ptr
-) RTEMS_DEPRECATED;
-#endif
-
#if defined(__RTEMS_HAVE_SYS_CPUSET_H__)
/**
* @brief Gets the processor affinity set of a task.
diff --git a/cpukit/rtems/include/rtems/rtems/tasksimpl.h b/cpukit/rtems/include/rtems/rtems/tasksimpl.h
index 3f8a87361b..82e8618b8c 100644
--- a/cpukit/rtems/include/rtems/rtems/tasksimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/tasksimpl.h
@@ -47,21 +47,6 @@ extern Thread_Information _RTEMS_tasks_Information;
*/
void _RTEMS_tasks_Initialize_user_tasks( void );
-#if !defined(RTEMS_SMP)
-/**
- * @brief RTEMS Tasks Invoke Task Variable Destructor
- *
- * @deprecated Task variables are deprecated.
- *
- * This routine invokes the optional user provided destructor on the
- * task variable and frees the memory for the task variable.
- */
-void _RTEMS_Tasks_Invoke_task_variable_dtor(
- Thread_Control *the_thread,
- rtems_task_variable_t *tvp
-) RTEMS_DEPRECATED;
-#endif
-
RTEMS_INLINE_ROUTINE Thread_Control *_RTEMS_tasks_Allocate(void)
{
_Objects_Allocator_lock();
diff --git a/cpukit/rtems/mainpage.h b/cpukit/rtems/mainpage.h
index 9801bfb915..e2d51328cf 100644
--- a/cpukit/rtems/mainpage.h
+++ b/cpukit/rtems/mainpage.h
@@ -856,40 +856,10 @@
*
* @section ClassicTasksSecPerTaskVariables Per Task Variables
*
- * Per task variables are used to support global variables whose value may be
- * unique to a task. After indicating that a variable should be treated as
- * private (i.e. per-task) the task can access and modify the variable, but the
- * modifications will not appear to other tasks, and other tasks' modifications
- * to that variable will not affect the value seen by the task. This is
- * accomplished by saving and restoring the variable's value each time a task
- * switch occurs to or from the calling task.
- *
- * The value seen by other tasks, including those which have not added the
- * variable to their set and are thus accessing the variable as a common
- * location shared among tasks, can not be affected by a task once it has added
- * a variable to its local set. Changes made to the variable by other tasks
- * will not affect the value seen by a task which has added the variable to its
- * private set.
- *
- * This feature can be used when a routine is to be spawned repeatedly as
- * several independent tasks. Although each task will have its own stack, and
- * thus separate stack variables, they will all share the same static and
- * global variables. To make a variable not shareable (i.e. a "global" variable
- * that is specific to a single task), the tasks can call
- * rtems_task_variable_add() to make a separate copy of the variable for each
- * task, but all at the same physical address.
- *
- * Task variables increase the context switch time to and from the tasks that
- * own them so it is desirable to minimize the number of task variables. One
- * efficient method is to have a single task variable that is a pointer to a
- * dynamically allocated structure containing the task's private "global" data.
- *
- * A critical point with per-task variables is that each task must separately
- * request that the same global variable is per-task private.
- *
- * @b {WARNING}: Per-task variables are fundamentally incorrect in SMP
- * systems and should not be used in SMP applications. They
- * are disabled.
+ * Per task variables are no longer available. In particular the
+ * rtems_task_variable_add(), rtems_task_variable_get() and
+ * rtems_task_variable_delete() functions are neither declared nor defined
+ * anymore. Use thread local storage or POSIX Keys instead.
*
* @section ClassicTasksSecBuildingTaskAttributeSet Building a Task Attribute Set
*
diff --git a/cpukit/rtems/src/tasks.c b/cpukit/rtems/src/tasks.c
index f18e0ab3db..56b2455ad7 100644
--- a/cpukit/rtems/src/tasks.c
+++ b/cpukit/rtems/src/tasks.c
@@ -18,20 +18,13 @@
#include "config.h"
#endif
-#include <rtems/system.h>
#include <rtems/config.h>
#include <rtems/sysinit.h>
#include <rtems/rtems/asrimpl.h>
#include <rtems/rtems/eventimpl.h>
-#include <rtems/rtems/signalimpl.h>
-#include <rtems/rtems/status.h>
-#include <rtems/rtems/support.h>
-#include <rtems/rtems/modes.h>
#include <rtems/rtems/tasksimpl.h>
-#include <rtems/score/stack.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/userextimpl.h>
-#include <rtems/score/wkspace.h>
Thread_Information _RTEMS_tasks_Information;
@@ -91,87 +84,12 @@ static void _RTEMS_tasks_Delete_extension(
_ASR_Destroy( &api->Signal );
}
-static void _RTEMS_tasks_Terminate_extension(
- Thread_Control *executing
-)
-{
- /*
- * Free per task variable memory
- *
- * Per Task Variables are only enabled in uniprocessor configurations.
- */
- #if !defined(RTEMS_SMP)
- /*
- * We know this is deprecated and don't want a warning on every BSP built.
- */
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
- do {
- rtems_task_variable_t *tvp, *next;
-
- tvp = executing->task_variables;
- executing->task_variables = NULL;
- while (tvp) {
- next = (rtems_task_variable_t *)tvp->next;
- _RTEMS_Tasks_Invoke_task_variable_dtor( executing, tvp );
- tvp = next;
- }
- } while (0);
- #pragma GCC diagnostic pop
- #endif
-}
-
-#if !defined(RTEMS_SMP)
-/*
- * _RTEMS_tasks_Switch_extension
- *
- * This extension routine is invoked at each context switch.
- *
- * @note Since this only needs to address per-task variables, it is
- * disabled entirely for SMP configurations.
- */
-static void _RTEMS_tasks_Switch_extension(
- Thread_Control *executing,
- Thread_Control *heir
-)
-{
- rtems_task_variable_t *tvp;
-
- /*
- * Per Task Variables are only enabled in uniprocessor configurations
- */
-
- tvp = executing->task_variables;
- while (tvp) {
- tvp->tval = *tvp->ptr;
- *tvp->ptr = tvp->gval;
- tvp = (rtems_task_variable_t *)tvp->next;
- }
-
- tvp = heir->task_variables;
- while (tvp) {
- tvp->gval = *tvp->ptr;
- *tvp->ptr = tvp->tval;
- tvp = (rtems_task_variable_t *)tvp->next;
- }
-}
-#define RTEMS_TASKS_SWITCH_EXTENSION _RTEMS_tasks_Switch_extension
-#else
-#define RTEMS_TASKS_SWITCH_EXTENSION NULL
-#endif
-
User_extensions_Control _RTEMS_tasks_User_extensions = {
- { NULL, NULL },
- { { NULL, NULL }, RTEMS_TASKS_SWITCH_EXTENSION },
- { _RTEMS_tasks_Create_extension, /* create */
- _RTEMS_tasks_Start_extension, /* start */
- _RTEMS_tasks_Start_extension, /* restart */
- _RTEMS_tasks_Delete_extension, /* delete */
- RTEMS_TASKS_SWITCH_EXTENSION, /* switch */
- NULL, /* begin */
- NULL, /* exitted */
- NULL, /* fatal */
- _RTEMS_tasks_Terminate_extension /* terminate */
+ .Callouts = {
+ .thread_create = _RTEMS_tasks_Create_extension,
+ .thread_start = _RTEMS_tasks_Start_extension,
+ .thread_restart = _RTEMS_tasks_Start_extension,
+ .thread_delete = _RTEMS_tasks_Delete_extension
}
};
diff --git a/cpukit/rtems/src/taskvariable_invoke_dtor.c b/cpukit/rtems/src/taskvariable_invoke_dtor.c
deleted file mode 100644
index b9213f2bd6..0000000000
--- a/cpukit/rtems/src/taskvariable_invoke_dtor.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * @file
- *
- * @brief RTEMS Tasks Invoke Task Variable Destructor
- * @ingroup ClassicTasks
- */
-
-/*
- * COPYRIGHT (c) 1989-2014.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#if !defined(RTEMS_SMP)
-#include <rtems/rtems/tasksimpl.h>
-#include <rtems/score/threadimpl.h>
-#include <rtems/score/wkspace.h>
-
-/*
- * We know this is deprecated and don't want a warning on every BSP built.
- */
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-
-void _RTEMS_Tasks_Invoke_task_variable_dtor(
- Thread_Control *the_thread,
- rtems_task_variable_t *tvp
-)
-{
- void (*dtor)(void *);
- void *value;
-
- dtor = tvp->dtor;
- if (_Thread_Get_executing() == the_thread) {
- value = *tvp->ptr;
- *tvp->ptr = tvp->gval;
- } else {
- value = tvp->tval;
- }
-
- if ( dtor )
- (*dtor)(value);
-
- _Workspace_Free(tvp);
-}
-#endif
diff --git a/cpukit/rtems/src/taskvariableadd.c b/cpukit/rtems/src/taskvariableadd.c
deleted file mode 100644
index 0fea945fba..0000000000
--- a/cpukit/rtems/src/taskvariableadd.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * @file
- *
- * @brief RTEMS Add Task Variable
- * @ingroup ClassicTasks
- */
-
-/*
- * COPYRIGHT (c) 1989-2014.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#if !defined(RTEMS_SMP)
-#include <rtems/rtems/tasks.h>
-#include <rtems/score/threadimpl.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/config.h>
-
-/*
- * We know this is deprecated and don't want a warning on every BSP built.
- */
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-
-rtems_status_code rtems_task_variable_add(
- rtems_id tid,
- void **ptr,
- void (*dtor)(void *)
-)
-{
- Thread_Control *the_thread;
- Objects_Locations location;
- rtems_task_variable_t *tvp, *new;
-
-#if defined( RTEMS_SMP )
- if ( rtems_configuration_is_smp_enabled() ) {
- return RTEMS_NOT_IMPLEMENTED;
- }
-#endif
-
- if ( !ptr )
- return RTEMS_INVALID_ADDRESS;
-
- the_thread = _Thread_Get (tid, &location);
- switch (location) {
-
- case OBJECTS_LOCAL:
- /*
- * Figure out if the variable is already in this task's list.
- */
- tvp = the_thread->task_variables;
- while (tvp) {
- if (tvp->ptr == ptr) {
- tvp->dtor = dtor;
- _Objects_Put( &the_thread->Object );
- return RTEMS_SUCCESSFUL;
- }
- tvp = (rtems_task_variable_t *)tvp->next;
- }
-
- /*
- * Now allocate memory for this task variable.
- */
- new = (rtems_task_variable_t *)
- _Workspace_Allocate(sizeof(rtems_task_variable_t));
- if (new == NULL) {
- _Objects_Put( &the_thread->Object );
- return RTEMS_NO_MEMORY;
- }
- new->gval = *ptr;
- new->ptr = ptr;
- new->dtor = dtor;
-
- new->next = (struct rtems_task_variable_tt *)the_thread->task_variables;
- the_thread->task_variables = new;
- _Objects_Put( &the_thread->Object );
- return RTEMS_SUCCESSFUL;
-
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
- _Thread_Dispatch();
- return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
-#endif
-
- case OBJECTS_ERROR:
- break;
- }
- return RTEMS_INVALID_ID;
-}
-#endif
diff --git a/cpukit/rtems/src/taskvariabledelete.c b/cpukit/rtems/src/taskvariabledelete.c
deleted file mode 100644
index 3f7f84e103..0000000000
--- a/cpukit/rtems/src/taskvariabledelete.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * @file
- *
- * @brief RTEMS Delete Task Variable
- * @ingroup ClassicTasks
- */
-
-/*
- * COPYRIGHT (c) 1989-2014.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#if !defined(RTEMS_SMP)
-#include <rtems/rtems/tasksimpl.h>
-#include <rtems/score/threadimpl.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/config.h>
-
-/*
- * We know this is deprecated and don't want a warning on every BSP built.
- */
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-
-rtems_status_code rtems_task_variable_delete(
- rtems_id tid,
- void **ptr
-)
-{
- Thread_Control *the_thread;
- Objects_Locations location;
- rtems_task_variable_t *tvp, *prev;
-
-#if defined( RTEMS_SMP )
- if ( rtems_configuration_is_smp_enabled() ) {
- return RTEMS_NOT_IMPLEMENTED;
- }
-#endif
-
- if ( !ptr )
- return RTEMS_INVALID_ADDRESS;
-
- prev = NULL;
-
- the_thread = _Thread_Get (tid, &location);
- switch (location) {
-
- case OBJECTS_LOCAL:
- tvp = the_thread->task_variables;
- while (tvp) {
- if (tvp->ptr == ptr) {
- if (prev)
- prev->next = tvp->next;
- else
- the_thread->task_variables = (rtems_task_variable_t *)tvp->next;
-
- _RTEMS_Tasks_Invoke_task_variable_dtor( the_thread, tvp );
- _Objects_Put( &the_thread->Object );
- return RTEMS_SUCCESSFUL;
- }
- prev = tvp;
- tvp = (rtems_task_variable_t *)tvp->next;
- }
- _Objects_Put( &the_thread->Object );
- return RTEMS_INVALID_ADDRESS;
-
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
- _Thread_Dispatch();
- return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
-#endif
-
- case OBJECTS_ERROR:
- break;
- }
-
- return RTEMS_INVALID_ID;
-}
-#endif
diff --git a/cpukit/rtems/src/taskvariableget.c b/cpukit/rtems/src/taskvariableget.c
deleted file mode 100644
index 3b9cd25a86..0000000000
--- a/cpukit/rtems/src/taskvariableget.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * @file
- *
- * @brief Get a per-task variable
- * @ingroup ClassicTasks Tasks
- */
-
-/*
- * COPYRIGHT (c) 1989-2014.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#if !defined(RTEMS_SMP)
-#include <rtems/rtems/tasksimpl.h>
-#include <rtems/score/threadimpl.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/config.h>
-
-/*
- * We know this is deprecated and don't want a warning on every BSP built.
- */
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-
-rtems_status_code rtems_task_variable_get(
- rtems_id tid,
- void **ptr,
- void **result
-)
-{
- Thread_Control *the_thread;
- Objects_Locations location;
- rtems_task_variable_t *tvp;
-
-#if defined( RTEMS_SMP )
- if ( rtems_configuration_is_smp_enabled() ) {
- return RTEMS_NOT_IMPLEMENTED;
- }
-#endif
-
- if ( !ptr )
- return RTEMS_INVALID_ADDRESS;
-
- if ( !result )
- return RTEMS_INVALID_ADDRESS;
-
- the_thread = _Thread_Get (tid, &location);
- switch (location) {
-
- case OBJECTS_LOCAL:
- /*
- * Figure out if the variable is in this task's list.
- */
- tvp = the_thread->task_variables;
- while (tvp) {
- if (tvp->ptr == ptr) {
- /*
- * Should this return the current (i.e not the
- * saved) value if `tid' is the current task?
- */
- *result = tvp->tval;
- _Objects_Put( &the_thread->Object );
- return RTEMS_SUCCESSFUL;
- }
- tvp = (rtems_task_variable_t *)tvp->next;
- }
- _Objects_Put( &the_thread->Object );
- return RTEMS_INVALID_ADDRESS;
-
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
- _Thread_Dispatch();
- return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
-#endif
-
- case OBJECTS_ERROR:
- break;
- }
- return RTEMS_INVALID_ID;
-}
-#endif