Patch from Eric Norum <eric@cls.usask.ca> to make task variables maintain

a global and private version of each task variable.
This commit is contained in:
Joel Sherrill
2000-05-01 17:31:29 +00:00
parent fee06c867b
commit 305f03339c
4 changed files with 10 additions and 5 deletions

View File

@@ -105,6 +105,8 @@ User_extensions_routine _RTEMS_tasks_Delete_extension(
next = tvp->next;
if (tvp->dtor)
(*tvp->dtor)( tvp->ptr );
if (executing == deleted)
*tvp->ptr = tvp->gval;
_Workspace_Free( tvp );
tvp = next;
}
@@ -137,13 +139,15 @@ void _RTEMS_tasks_Switch_extension(
tvp = executing->task_variables;
while (tvp) {
tvp->var = *tvp->ptr;
tvp->tval = *tvp->ptr;
*tvp->ptr = tvp->gval;
tvp = tvp->next;
}
tvp = heir->task_variables;
while (tvp) {
*tvp->ptr = tvp->var;
tvp->gval = *tvp->ptr;
*tvp->ptr = tvp->tval;
tvp = tvp->next;
}
}

View File

@@ -72,7 +72,7 @@ rtems_status_code rtems_task_variable_add(
_Thread_Enable_dispatch();
return RTEMS_NO_MEMORY;
}
new->var = 0;
new->gval = *ptr;
new->ptr = ptr;
new->dtor = dtor;

View File

@@ -59,7 +59,7 @@ rtems_status_code rtems_task_variable_get(
* Should this return the current (i.e not the
* saved) value if `tid' is the current task?
*/
*result = tvp->var;
*result = tvp->tval;
_Thread_Enable_dispatch();
return RTEMS_SUCCESSFUL;
}

View File

@@ -94,7 +94,8 @@ struct rtems_task_variable_tt;
struct rtems_task_variable_tt {
struct rtems_task_variable_tt *next;
void **ptr;
void *var;
void *gval;
void *tval;
void (*dtor)(void *);
};