source: rtems/c/src/exec/rtems/src/taskvariabledelete.c @ 95bb279

4.104.114.84.95
Last change on this file since 95bb279 was 95bb279, checked in by Joel Sherrill <joel.sherrill@…>, on 11/12/99 at 14:54:13

Used typedef so all "struct rtems_task_variable_t" uses are now
just "rtems_task_variable_t".

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  rtems_task_variable_delete - Delete a per-task variable
3 *
4 *
5 *  COPYRIGHT (c) 1989-1998.
6 *  On-Line Applications Research Corporation (OAR).
7 *  Copyright assigned to U.S. Government, 1994.
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.OARcorp.com/rtems/license.html.
12 *
13 *  $Id$
14 */
15
16#include <rtems/system.h>
17#include <rtems/rtems/tasks.h>
18#include <rtems/score/wkspace.h>
19
20/*
21 *  rtems_task_variable_delete
22 *
23 *  This directive removes a task variable.
24 */
25
26rtems_status_code rtems_task_variable_delete(
27  rtems_id  tid,
28  int      *ptr
29)
30{
31  Thread_Control        *the_thread;
32  Objects_Locations      location;
33  RTEMS_API_Control     *api;
34  rtems_task_variable_t *tvp, *prev;
35
36  prev = NULL;
37
38  the_thread = _Thread_Get (tid, &location);
39  switch (location) {
40  case OBJECTS_REMOTE:
41#if defined(RTEMS_MULTIPROCESSING)
42    _Thread_Dispatch();
43    return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
44#endif
45
46  case OBJECTS_ERROR:
47    return RTEMS_INVALID_ID;
48
49  default:
50    return RTEMS_INTERNAL_ERROR;
51
52  case OBJECTS_LOCAL:
53    api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
54    tvp = api->task_variables;
55    while (tvp) {
56      if (tvp->ptr == ptr) {
57        if (prev) prev->next = tvp->next;
58        else      api->task_variables = tvp->next;
59        _Thread_Enable_dispatch();
60        _Workspace_Free(tvp);
61        return RTEMS_SUCCESSFUL;
62      }
63      prev = tvp;
64      tvp = tvp->next;
65    }
66    _Thread_Enable_dispatch();
67    return RTEMS_INVALID_ADDRESS;
68  }
69
70  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
71}
Note: See TracBrowser for help on using the repository browser.