source: rtems/cpukit/score/src/threadclose.c @ 9b4422a2

4.115
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*
2 *  Thread Handler / Thread Close
3 *
4 *  COPYRIGHT (c) 1989-2011.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 */
11
12#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <rtems/system.h>
17#include <rtems/score/apiext.h>
18#include <rtems/score/context.h>
19#include <rtems/score/interr.h>
20#include <rtems/score/isr.h>
21#include <rtems/score/object.h>
22#include <rtems/score/priority.h>
23#include <rtems/score/scheduler.h>
24#include <rtems/score/states.h>
25#include <rtems/score/sysstate.h>
26#include <rtems/score/thread.h>
27#include <rtems/score/threadq.h>
28#include <rtems/score/userext.h>
29#include <rtems/score/wkspace.h>
30
31void _Thread_Close(
32  Objects_Information  *information,
33  Thread_Control       *the_thread
34)
35{
36  /*
37   *  Now we are in a dispatching critical section again and we
38   *  can take the thread OUT of the published set.  It is invalid
39   *  to use this thread's Id after this call.  This will prevent
40   *  any other task from attempting to initiate a call on this task.
41   */
42  _Objects_Invalidate_Id( information, &the_thread->Object );
43
44  /*
45   *  We assume the Allocator Mutex is locked when we get here.
46   *  This provides sufficient protection to let the user extensions
47   *  run but as soon as we get back, we will make the thread
48   *  disappear and set a transient state on it.  So we temporarily
49   *  unnest dispatching.
50   */
51  _Thread_Unnest_dispatch();
52
53  _User_extensions_Thread_delete( the_thread );
54
55  _Thread_Disable_dispatch();
56
57  /*
58   *  Now we are in a dispatching critical section again and we
59   *  can take the thread OUT of the published set.  It is invalid
60   *  to use this thread's Id OR name after this call.
61   */
62  _Objects_Close( information, &the_thread->Object );
63
64  /*
65   *  By setting the dormant state, the thread will not be considered
66   *  for scheduling when we remove any blocking states.
67   */
68  _Thread_Set_state( the_thread, STATES_DORMANT );
69
70  if ( !_Thread_queue_Extract_with_proxy( the_thread ) ) {
71    if ( _Watchdog_Is_active( &the_thread->Timer ) )
72      (void) _Watchdog_Remove( &the_thread->Timer );
73  }
74
75  /*
76   * Free the per-thread scheduling information.
77   */
78  _Scheduler_Free( the_thread );
79
80  /*
81   *  The thread might have been FP.  So deal with that.
82   */
83#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
84#if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE )
85  if ( _Thread_Is_allocated_fp( the_thread ) )
86    _Thread_Deallocate_fp();
87#endif
88  the_thread->fp_context = NULL;
89
90  _Workspace_Free( the_thread->Start.fp_context );
91#endif
92
93  /*
94   *  Free the rest of the memory associated with this task
95   *  and set the associated pointers to NULL for safety.
96   */
97  _Thread_Stack_Free( the_thread );
98  the_thread->Start.stack = NULL;
99
100  _Workspace_Free( the_thread->extensions );
101  the_thread->extensions = NULL;
102}
Note: See TracBrowser for help on using the repository browser.