source: rtems/cpukit/score/src/threadclose.c @ fa6b0f5

4.104.114.84.95
Last change on this file since fa6b0f5 was a8eed23, checked in by Ralf Corsepius <ralf.corsepius@…>, on 01/27/05 at 05:57:05

Include config.h.

  • Property mode set to 100644
File size: 1.9 KB
Line 
1/*
2 *  Thread Handler
3 *
4 *
5 *  COPYRIGHT (c) 1989-1999.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in found in the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 *
12 *  $Id$
13 */
14
15#if HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <rtems/system.h>
20#include <rtems/score/apiext.h>
21#include <rtems/score/context.h>
22#include <rtems/score/interr.h>
23#include <rtems/score/isr.h>
24#include <rtems/score/object.h>
25#include <rtems/score/priority.h>
26#include <rtems/score/states.h>
27#include <rtems/score/sysstate.h>
28#include <rtems/score/thread.h>
29#include <rtems/score/threadq.h>
30#include <rtems/score/userext.h>
31#include <rtems/score/wkspace.h>
32
33/*
34 *  _Thread_Close
35 *
36 *  DESCRIPTION:
37 *
38 *  This routine frees all memory associated with the specified
39 *  thread and removes it from the local object table so no further
40 *  operations on this thread are allowed.
41 */
42
43void _Thread_Close(
44  Objects_Information  *information,
45  Thread_Control       *the_thread
46)
47{
48  _User_extensions_Thread_delete( the_thread );
49
50  _Objects_Close( information, &the_thread->Object );
51
52  _Thread_Set_state( the_thread, STATES_TRANSIENT );
53
54  if ( !_Thread_queue_Extract_with_proxy( the_thread ) ) {
55    if ( _Watchdog_Is_active( &the_thread->Timer ) )
56      (void) _Watchdog_Remove( &the_thread->Timer );
57  }
58
59#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
60#if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE )
61  if ( _Thread_Is_allocated_fp( the_thread ) )
62    _Thread_Deallocate_fp();
63#endif
64  the_thread->fp_context = NULL;
65
66  if ( the_thread->Start.fp_context )
67    (void) _Workspace_Free( the_thread->Start.fp_context );
68#endif
69
70  _Thread_Stack_Free( the_thread );
71
72  if ( the_thread->extensions )
73    (void) _Workspace_Free( the_thread->extensions );
74
75  the_thread->Start.stack = NULL;
76  the_thread->extensions = NULL;
77}
Note: See TracBrowser for help on using the repository browser.