source: rtems/cpukit/score/src/threadstackfree.c @ c86da31c

4.115
Last change on this file since c86da31c was bacf79e, checked in by Joel Sherrill <joel.sherrill@…>, on 09/13/09 at 21:00:11

2009-09-13 Joel Sherrill <joel.sherrill@…>

  • score/include/rtems/score/thread.h, score/src/threadinitialize.c, score/src/threadstackfree.c: Disable capability for API to let user provide thread stack when no API configured includes this capability.
  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 *  Thread Handler
3 *
4 *
5 *  COPYRIGHT (c) 1989-2008.
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#include <rtems/config.h>
33
34/*
35 *  _Thread_Stack_Free
36 *
37 *  Deallocate the Thread's stack.
38 */
39
40void _Thread_Stack_Free(
41  Thread_Control *the_thread
42)
43{
44  #if defined(RTEMS_SCORE_THREAD_ENABLE_USER_PROVIDED_STACK_VIA_API)
45    /*
46     *  If the API provided the stack space, then don't free it.
47     */
48    if ( !the_thread->Start.core_allocated_stack )
49      return;
50  #endif
51
52  /*
53   * Call ONLY the CPU table stack free hook, or the
54   * the RTEMS workspace free.  This is so the free
55   * routine properly matches the allocation of the stack.
56   */
57
58  if ( Configuration.stack_free_hook )
59    (*Configuration.stack_free_hook)( the_thread->Start.Initial_stack.area );
60  else
61    _Workspace_Free( the_thread->Start.Initial_stack.area );
62}
Note: See TracBrowser for help on using the repository browser.