source: rtems/cpukit/rtems/src/taskvariable_invoke_dtor.c @ 0a6d12a

4.115
Last change on this file since 0a6d12a was d507c037, checked in by Joel Sherrill <joel.sherrill@…>, on 04/03/14 at 17:55:43

Disable per task variables when SMP is enabled

Per task variables are inherently unsafe in SMP systems. This
patch disables them from the build and adds warnings in the
appropriate documentation and configuration sections.

  • Property mode set to 100644
File size: 909 bytes
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Tasks Invoke Task Variable Destructor
5 *  @ingroup ClassicTasks
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2014.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#if !defined(RTEMS_SMP)
22#include <rtems/rtems/tasksimpl.h>
23#include <rtems/score/threadimpl.h>
24#include <rtems/score/wkspace.h>
25
26void _RTEMS_Tasks_Invoke_task_variable_dtor(
27  Thread_Control        *the_thread,
28  rtems_task_variable_t *tvp
29)
30{
31  void (*dtor)(void *);
32  void *value;
33
34  dtor = tvp->dtor;
35  if (_Thread_Get_executing() == the_thread) {
36    value = *tvp->ptr;
37    *tvp->ptr = tvp->gval;
38  } else {
39    value = tvp->tval;
40  }
41
42  if ( dtor )
43    (*dtor)(value);
44
45  _Workspace_Free(tvp);
46}
47#endif
Note: See TracBrowser for help on using the repository browser.