source: rtems/cpukit/score/src/threadclose.c @ 0cb7cb9

4.104.114.84.95
Last change on this file since 0cb7cb9 was 0cb7cb9, checked in by Joel Sherrill <joel.sherrill@…>, on 11/16/99 at 16:10:39

Added comments.

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
2 *  Thread Handler
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 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/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/states.h>
24#include <rtems/score/sysstate.h>
25#include <rtems/score/thread.h>
26#include <rtems/score/threadq.h>
27#include <rtems/score/userext.h>
28#include <rtems/score/wkspace.h>
29
30/*
31 *  _Thread_Close
32 *
33 *  DESCRIPTION:
34 *
35 *  This routine frees all memory associated with the specified
36 *  thread and removes it from the local object table so no further
37 *  operations on this thread are allowed.
38 */
39 
40void _Thread_Close(
41  Objects_Information  *information,
42  Thread_Control       *the_thread
43)
44{
45  _Objects_Close( information, &the_thread->Object );
46 
47  _Thread_Set_state( the_thread, STATES_TRANSIENT );
48 
49  if ( !_Thread_queue_Extract_with_proxy( the_thread ) ) {
50 
51    if ( _Watchdog_Is_active( &the_thread->Timer ) )
52      (void) _Watchdog_Remove( &the_thread->Timer );
53  }
54
55  _User_extensions_Thread_delete( the_thread );
56 
57#if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE )
58  if ( _Thread_Is_allocated_fp( the_thread ) )
59    _Thread_Deallocate_fp();
60#endif
61  the_thread->fp_context = NULL;
62
63  if ( the_thread->Start.fp_context )
64  (void) _Workspace_Free( the_thread->Start.fp_context );
65
66  _Thread_Stack_Free( the_thread );
67
68  if ( the_thread->extensions )
69    (void) _Workspace_Free( the_thread->extensions );
70
71  the_thread->Start.stack = NULL;
72  the_thread->extensions = NULL;
73}
Note: See TracBrowser for help on using the repository browser.