Ticket #1777: DispatchPatch.diff

File DispatchPatch.diff, 25.3 KB (added by Jennifer Averett, on 04/13/11 at 16:42:12)

consolidate access to _Thread_Dispatch_disable_level

  • c/src/lib/libbsp/powerpc/shared/startup/panic.c

    ? testsuites/support/include/.tmacros.h.swp
    RCS file: /usr1/CVS/rtems/c/src/lib/libbsp/powerpc/shared/startup/panic.c,v
    retrieving revision 1.8
    diff -u -r1.8 panic.c
     
    101101      printk("  UNKNOWN (0x%x)\n",THESRC);
    102102  break;
    103103  }
    104   if ( _Thread_Dispatch_disable_level )
     104  if ( _Thread_Dispatch_in_critical_section() )
    105105    printk(
    106106      "  Error occurred in a Thread Dispatching DISABLED context (level %i)\n",
    107       _Thread_Dispatch_disable_level);
     107      _Thread_Dispatch_get_disable_level());
    108108  else
    109109    printk("enabled\n");
    110110
  • c/src/lib/libcpu/sh/sh7032/score/cpu_asm.c

    RCS file: /usr1/CVS/rtems/c/src/lib/libcpu/sh/sh7032/score/cpu_asm.c,v
    retrieving revision 1.18
    diff -u -r1.18 cpu_asm.c
     
    134134
    135135  _ISR_Disable( level );
    136136
    137   _Thread_Dispatch_disable_level++;
     137  _Thread_Dispatch_increment_disable_level();
    138138
    139139#if (CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
    140140  if ( _ISR_Nest_level == 0 )
     
    156156
    157157  _ISR_Disable( level );
    158158
    159   _Thread_Dispatch_disable_level--;
     159  _Thread_Dispatch_decrement_disable_level();
    160160
    161161  _ISR_Nest_level--;
    162162
     
    172172  if ( _ISR_Nest_level )
    173173    return;
    174174
    175   if ( _Thread_Dispatch_disable_level ) {
     175  if ( _Thread_Dispatch_in_critical_section() ) {
    176176    return;
    177177  }
    178178
  • c/src/lib/libcpu/sh/sh7045/score/cpu_asm.c

    RCS file: /usr1/CVS/rtems/c/src/lib/libcpu/sh/sh7045/score/cpu_asm.c,v
    retrieving revision 1.20
    diff -u -r1.20 cpu_asm.c
     
    136136
    137137  _ISR_Disable( level );
    138138
    139   _Thread_Dispatch_disable_level++;
     139  _Thread_Dispatch_increment_disable_level();
    140140
    141141#if (CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
    142142  if ( _ISR_Nest_level == 0 )
     
    158158
    159159  _ISR_Disable( level );
    160160
    161   _Thread_Dispatch_disable_level--;
     161  _Thread_Dispatch_decrement_disable_level();
    162162
    163163  _ISR_Nest_level--;
    164164
     
    174174  if ( _ISR_Nest_level )
    175175    return;
    176176
    177   if ( _Thread_Dispatch_disable_level ) {
     177  if ( _Thread_Dispatch_in_critical_section() ) {
    178178    return;
    179179  }
    180180
  • c/src/lib/libcpu/sh/sh7750/score/cpu_asm.c

    RCS file: /usr1/CVS/rtems/c/src/lib/libcpu/sh/sh7750/score/cpu_asm.c,v
    retrieving revision 1.16
    diff -u -r1.16 cpu_asm.c
     
    6060
    6161  _ISR_Disable( level );
    6262
    63   _Thread_Dispatch_disable_level++;
     63   _Thread_Dispatch_increment_disable_level();
    6464
    6565#if (CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
    6666  if ( _ISR_Nest_level == 0 )
     
    8282
    8383  _ISR_Disable( level );
    8484
    85   _Thread_Dispatch_disable_level--;
     85  _Thread_Dispatch_decrement_disable_level();
    8686
    8787  _ISR_Nest_level--;
    8888
     
    9797  if ( _ISR_Nest_level )
    9898    return;
    9999
    100   if ( _Thread_Dispatch_disable_level ) {
     100  if ( _Thread_Dispatch_in_critical_section() ) {
    101101    return;
    102102  }
    103103
  • c/src/lib/libcpu/sh/shgdb/score/cpu_asm.c

    RCS file: /usr1/CVS/rtems/c/src/lib/libcpu/sh/shgdb/score/cpu_asm.c,v
    retrieving revision 1.5
    diff -u -r1.5 cpu_asm.c
     
    3333
    3434  _ISR_Disable( level );
    3535
    36   _Thread_Dispatch_disable_level++;
     36  _Thread_Dispatch_increment_disable_level();
    3737
    3838#if (CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
    3939  if ( _ISR_Nest_level == 0 )
     
    5555
    5656  _ISR_Disable( level );
    5757
    58   _Thread_Dispatch_disable_level--;
     58  _Thread_Dispatch_decrement_disable_level();
    5959
    6060  _ISR_Nest_level--;
    6161
     
    7171  if ( _ISR_Nest_level )
    7272    return;
    7373
    74   if ( _Thread_Dispatch_disable_level ) {
     74  if ( _Thread_Dispatch_in_critical_section() ) {
    7575    return;
    7676  }
    7777
  • cpukit/libcsupport/src/malloc_deferred.c

    RCS file: /usr1/CVS/rtems/cpukit/libcsupport/src/malloc_deferred.c,v
    retrieving revision 1.4
    diff -u -r1.4 malloc_deferred.c
     
    2626
    2727bool malloc_is_system_state_OK(void)
    2828{
    29   if ( _Thread_Dispatch_disable_level > 0 )
     29  if ( _Thread_Dispatch_in_critical_section() )
    3030    return false;
    3131
    3232  if ( _ISR_Nest_level > 0 )
  • cpukit/libcsupport/src/realloc.c

    RCS file: /usr1/CVS/rtems/cpukit/libcsupport/src/realloc.c,v
    retrieving revision 1.7
    diff -u -r1.7 realloc.c
     
    3535   */
    3636
    3737  if (_System_state_Is_up(_System_state_Get())) {
    38     if (_Thread_Dispatch_disable_level > 0)
     38    if (_Thread_Dispatch_in_critical_section())
    3939      return (void *) 0;
    4040
    4141    if (_ISR_Nest_level > 0)
  • cpukit/score/Makefile.am

    RCS file: /usr1/CVS/rtems/cpukit/score/Makefile.am,v
    retrieving revision 1.95
    diff -u -r1.95 Makefile.am
     
    189189libscore_a_SOURCES += src/thread.c src/threadchangepriority.c \
    190190    src/threadclearstate.c src/threadclose.c src/threadcreateidle.c \
    191191    src/threaddelayended.c src/threaddispatch.c \
     192    src/threadenabledispatch.c src/threaddisabledispatch.c \
    192193    src/threadget.c src/threadhandler.c src/threadinitialize.c \
    193194    src/threadloadenv.c src/threadready.c src/threadreset.c \
    194195    src/threadrestart.c src/threadsetpriority.c \
  • cpukit/score/cpu/lm32/irq.c

    RCS file: /usr1/CVS/rtems/cpukit/score/cpu/lm32/irq.c,v
    retrieving revision 1.7
    diff -u -r1.7 irq.c
     
    4444
    4545  /* Interrupts are disabled upon entry to this Handler */
    4646
    47   _Thread_Dispatch_disable_level++;
     47  _Thread_Dispatch_increment_disable_level();
    4848
    4949#if( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE)
    5050  if ( _ISR_Nest_level == 0 ) {
     
    7171    stack_ptr = _old_stack_ptr;
    7272#endif
    7373
    74   _Thread_Dispatch_disable_level--;
     74  _Thread_Dispatch_decrement_disable_level();
    7575
    7676  _CPU_ISR_Enable( level );
    7777
  • cpukit/score/cpu/nios2/irq.c

    RCS file: /usr1/CVS/rtems/cpukit/score/cpu/nios2/irq.c,v
    retrieving revision 1.8
    diff -u -r1.8 irq.c
     
    5050
    5151  _ISR_Nest_level++;
    5252
    53   _Thread_Dispatch_disable_level++;
     53  _Thread_Dispatch_increment_disable_level();
    5454
    5555  if ( _ISR_Vector_table[ vector] )
    5656  {
     
    6060  /* Make sure that interrupts are disabled again */
    6161  _CPU_ISR_Disable( level );
    6262
    63   _Thread_Dispatch_disable_level--;
     63  _Thread_Dispatch_decrement_disable_level();
    6464
    6565  _ISR_Nest_level--;
    6666
     
    6969    stack_ptr = _old_stack_ptr;
    7070#endif
    7171
    72     if( _Thread_Dispatch_disable_level == 0 )
     72    if( !_Thread_Dispatch_in_critical_section() )
    7373    {
    7474      if ( _Thread_Dispatch_necessary ) {
    7575        _CPU_ISR_Enable( level );
  • cpukit/score/include/rtems/score/coremutex.h

    RCS file: /usr1/CVS/rtems/cpukit/score/include/rtems/score/coremutex.h,v
    retrieving revision 1.42
    diff -u -r1.42 coremutex.h
     
    368368#define _CORE_mutex_Seize_body( \
    369369  _the_mutex, _id, _wait, _timeout, _level ) \
    370370  do { \
    371     if ( _Thread_Dispatch_disable_level \
     371    if ( _Thread_Dispatch_in_critical_section() \
    372372        && (_wait) \
    373373        && (_System_state_Get() >= SYSTEM_STATE_BEGIN_MULTITASKING ) \
    374374       ) { \
  • cpukit/score/include/rtems/score/thread.h

    RCS file: /usr1/CVS/rtems/cpukit/score/include/rtems/score/thread.h,v
    retrieving revision 1.100
    diff -u -r1.100 thread.h
     
    4646  #define RTEMS_SCORE_THREAD_ENABLE_USER_PROVIDED_STACK_VIA_API
    4747#endif
    4848
     49#if defined(RTEMS_SMP) || \
     50    defined(RTEMS_HEAVY_STACK_DEBUG) || \
     51    defined(RTEMS_HEAVY_MALLOC_DEBUG)
     52  #define __THREAD_DO_NOT_INLINE_DISABLE_DISPATCH__
     53#endif
     54
     55#if defined(RTEMS_SMP) || \
     56   (CPU_INLINE_ENABLE_DISPATCH == FALSE) || \
     57   (__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__ == 1)
     58  #define __THREAD_DO_NOT_INLINE_ENABLE_DISPATCH__
     59#endif
     60
    4961#ifdef __cplusplus
    5062extern "C" {
    5163#endif
  • cpukit/score/inline/rtems/score/thread.inl

    RCS file: /usr1/CVS/rtems/cpukit/score/inline/rtems/score/thread.inl,v
    retrieving revision 1.44
    diff -u -r1.44 thread.inl
     
    3232 */
    3333
    3434/**
     35 * This routine returns true if thread dispatch indicates
     36 * that we are in a critical section.
     37 */
     38RTEMS_INLINE_ROUTINE bool _Thread_Dispatch_in_critical_section(void)
     39{
     40   if (  _Thread_Dispatch_disable_level == 0 )
     41    return false;
     42
     43   return true;
     44}
     45
     46/**
     47 * This routine returns value of the the thread dispatch level.
     48 */
     49RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_get_disable_level(void)
     50{
     51  return _Thread_Dispatch_disable_level;
     52}
     53
     54/**
     55 * This routine sets thread dispatch level to the
     56 * value passed in.
     57 */
     58RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_set_disable_level(uint32_t value)
     59{
     60  _Thread_Dispatch_disable_level = value;
     61  return value;
     62}
     63
     64/**
     65 * This rountine increments the thread dispatch level
     66 */
     67RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_increment_disable_level(void)
     68{
     69  _Thread_Dispatch_disable_level++;
     70  return _Thread_Dispatch_disable_level;
     71}
     72
     73/**
     74 * This routine decrements the thread dispatch level.
     75 */
     76RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_decrement_disable_level(void)
     77{
     78  _Thread_Dispatch_disable_level--;
     79  return _Thread_Dispatch_disable_level;
     80}
     81
     82
     83/**
    3584 *  This routine halts multitasking and returns control to
    3685 *  the "thread" (i.e. the BSP) which initially invoked the
    3786 *  routine which initialized the system.
     
    150199 *  This routine prevents dispatching.
    151200 */
    152201
     202#if defined ( __THREAD_DO_NOT_INLINE_DISABLE_DISPATCH__ )
     203void _Thread_Disable_dispatch( void );
     204#else
     205
    153206#if defined(RTEMS_HEAVY_STACK_DEBUG) || defined(RTEMS_HEAVY_MALLOC_DEBUG)
    154207  #include <rtems/bspIo.h>
    155208  #include <rtems/fatal.h>
     
    163216   */
    164217  extern Heap_Control  *RTEMS_Malloc_Heap;
    165218#endif
    166 
    167219RTEMS_INLINE_ROUTINE void _Thread_Disable_dispatch( void )
    168220{
    169221  /*
     
    182234    }
    183235  #endif
    184236
    185   _Thread_Dispatch_disable_level += 1;
     237  _Thread_Dispatch_increment_disable_level();
    186238  RTEMS_COMPILER_MEMORY_BARRIER();
    187239
    188240  /*
     
    190242   * malloc heap integrity checking upon entry to every system call.
    191243   */
    192244  #if defined(RTEMS_HEAVY_MALLOC_DEBUG)
    193     if ( _Thread_Dispatch_disable_level == 1 ) {
     245    if ( Thread_Dispatch_disable_level_value() == 1 ) {
    194246      _Heap_Walk( RTEMS_Malloc_Heap,99, false );
    195247    }
    196248  #endif
    197249}
     250#endif
    198251
    199252/**
    200253 *  This routine allows dispatching to occur again.  If this is
     
    203256 *  processor will be transferred to the heir thread.
    204257 */
    205258
    206 #if ( (defined(CPU_INLINE_ENABLE_DISPATCH) && \
    207        (CPU_INLINE_ENABLE_DISPATCH == FALSE)) || \
    208       (__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__ == 1) )
    209 void _Thread_Enable_dispatch( void );
     259#if defined ( __THREAD_DO_NOT_INLINE_ENABLE_DISPATCH__ )
     260  void _Thread_Enable_dispatch( void );
    210261#else
    211 /* inlining of enable dispatching must be true */
    212 RTEMS_INLINE_ROUTINE void _Thread_Enable_dispatch( void )
    213 {
    214   RTEMS_COMPILER_MEMORY_BARRIER();
    215   if ( (--_Thread_Dispatch_disable_level) == 0 )
    216     _Thread_Dispatch();
    217 }
     262  /* inlining of enable dispatching must be true */
     263  RTEMS_INLINE_ROUTINE void _Thread_Enable_dispatch( void )
     264  {
     265    RTEMS_COMPILER_MEMORY_BARRIER();
     266    if ( Thread_Dispatch_disable_level_Decrement() == 0 )
     267      _Thread_Dispatch();
     268  }
    218269#endif
    219270
    220 
    221271/**
    222272 *  This routine allows dispatching to occur again.  However,
    223273 *  no dispatching operation is performed even if this is the outer
     
    227277RTEMS_INLINE_ROUTINE void _Thread_Unnest_dispatch( void )
    228278{
    229279  RTEMS_COMPILER_MEMORY_BARRIER();
    230   _Thread_Dispatch_disable_level -= 1;
     280  _Thread_Dispatch_decrement_disable_level();
    231281}
    232282
    233283/**
     
    237287
    238288RTEMS_INLINE_ROUTINE bool _Thread_Is_dispatching_enabled( void )
    239289{
    240   return ( _Thread_Dispatch_disable_level == 0 );
     290  return  ( _Thread_Dispatch_in_critical_section() == false );
    241291}
    242292
    243293/**
     
    256306
    257307RTEMS_INLINE_ROUTINE void _Thread_Dispatch_initialization( void )
    258308{
    259   _Thread_Dispatch_disable_level = 1;
     309  _Thread_Dispatch_set_disable_level( 1 );
    260310}
    261311
    262312/**
  • cpukit/score/src/heapfree.c

    RCS file: /usr1/CVS/rtems/cpukit/score/src/heapfree.c,v
    retrieving revision 1.15
    diff -u -r1.15 heapfree.c
     
    8989     * is the task stack of a thread that deletes itself.  The thread dispatch
    9090     * disable level is a way to detect this use case.
    9191     */
    92     if ( _Thread_Dispatch_disable_level == 0 ) {
     92    if ( !_Thread_Dispatch_in_critical_section() ) {
    9393      Heap_Block *const next = block->Protection_begin.next_delayed_free_block;
    9494      if ( next == NULL ) {
    9595        _Heap_Protection_delay_block_free( heap, block );
  • cpukit/score/src/pheapwalk.c

    RCS file: /usr1/CVS/rtems/cpukit/score/src/pheapwalk.c,v
    retrieving revision 1.5
    diff -u -r1.5 pheapwalk.c
     
    3939   *
    4040   * NOTE: Dispatching is also disabled during initialization.
    4141   */
    42   if ( !_Thread_Dispatch_disable_level ) {
     42  if ( _Thread_Dispatch_in_critical_section() == false ) {
    4343    _RTEMS_Lock_allocator();
    4444      status = _Heap_Walk( the_heap, source, do_dump );
    4545    _RTEMS_Unlock_allocator();
  • cpukit/score/src/smp.c

    RCS file: /usr1/CVS/rtems/cpukit/score/src/smp.c,v
    retrieving revision 1.1
    diff -u -r1.1 smp.c
     
    3737   *  This is definitely a hack until we have SMP scheduling.  Since there
    3838   *  is only one executing and heir right now, we have to fake this out.
    3939   */
    40   _Thread_Dispatch_disable_level = 1;
     40  _Thread_Dispatch_set_disable_level(1);
    4141  _Thread_Executing = heir;
    4242  _CPU_Context_switch_to_first_task_smp( &heir->Registers );
    4343}
     
    103103
    104104  if ( message & RTEMS_BSP_SMP_SHUTDOWN ) {
    105105    ISR_Level level;
    106     _Thread_Dispatch_disable_level = 0;
     106    _Thread_Dispatch_set_disable_level(0);
    107107    _Per_CPU_Information[cpu].isr_nest_level = 0;
    108108    _Per_CPU_Information[cpu].state = RTEMS_BSP_SMP_CPU_SHUTDOWN;
    109109    _ISR_Disable( level );
  • new file cpukit/score/src/threaddisabledispatch.c

    RCS file: cpukit/score/src/threaddisabledispatch.c
    diff -N cpukit/score/src/threaddisabledispatch.c
    - +  
     1/*
     2 *  _Thread_Disable_dispatch
     3 *
     4 *
     5 *  COPYRIGHT (c) 1989-2011.
     6 *  On-Line Applications Research Corporation (OAR).
     7 *
     8 *  The license and distribution terms for this file may be
     9 *  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/thread.h>
     21
     22#if defined ( __THREAD_DO_NOT_INLINE_DISABLE_DISPATCH__ )
     23void _Thread_Disable_dispatch( void )
     24{
     25  /*
     26   *  This check is very brutal to system performance but is very helpful
     27   *  at finding blown stack problems.  If you have a stack problem and
     28   *  need help finding it, then uncomment this code.  Every system
     29   *  call will check the stack and since mutexes are used frequently
     30   *  in most systems, you might get lucky.
     31   */
     32  #if defined(RTEMS_HEAVY_STACK_DEBUG)
     33    if (_System_state_Is_up(_System_state_Get()) && (_ISR_Nest_level == 0)) {
     34      if ( rtems_stack_checker_is_blown() ) {
     35        printk( "Stack blown!!\n" );
     36        rtems_fatal_error_occurred( 99 );
     37      }
     38    }
     39  #endif
     40
     41  _Thread_Dispatch_increment_disable_level();
     42  RTEMS_COMPILER_MEMORY_BARRIER();
     43
     44  /*
     45   * This check is even more brutal than the other one.  This enables
     46   * malloc heap integrity checking upon entry to every system call.
     47   */
     48  #if defined(RTEMS_HEAVY_MALLOC_DEBUG)
     49    if ( _Thread_Dispatch_get_disable_level() == 1 ) {
     50      _Heap_Walk( RTEMS_Malloc_Heap,99, false );
     51    }
     52  #endif
     53}
     54#endif
  • cpukit/score/src/threaddispatch.c

    RCS file: /usr1/CVS/rtems/cpukit/score/src/threaddispatch.c,v
    retrieving revision 1.23
    diff -u -r1.23 threaddispatch.c
     
    11/*
    22 *  Thread Handler
    33 *
    4  *
    54 *  COPYRIGHT (c) 1989-2009.
    65 *  On-Line Applications Research Corporation (OAR).
    76 *
     
    3433  #include <rtems/score/timestamp.h>
    3534#endif
    3635
    37 /*PAGE
    38  *
    39  *  _Thread_Enable_dispatch
    40  *
    41  *  This kernel routine exits a context switch disable critical section.
    42  *  This is the NOT INLINED version.
    43  *
    44  *  Input parameters:  NONE
    45  *
    46  *  Output parameters:  NONE
    47  *
    48  *  INTERRUPT LATENCY:
    49  *    dispatch thread
    50  *    no dispatch thread
    51  */
    52 
    53 #if ( (defined(CPU_INLINE_ENABLE_DISPATCH) &&  \
    54        (CPU_INLINE_ENABLE_DISPATCH == FALSE)) || \
    55       (__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__ == 1) )
    56 void _Thread_Enable_dispatch( void )
    57 {
    58   if ( --_Thread_Dispatch_disable_level )
    59     return;
    60   _Thread_Dispatch();
    61 }
    62 #endif
    63 
    64 /*PAGE
    65  *
     36/**
    6637 *  _Thread_Dispatch
    6738 *
    6839 *  This kernel routine determines if a dispatch is needed, and if so
     
    7243 *  ALTERNATE ENTRY POINTS:
    7344 *    void _Thread_Enable_dispatch();
    7445 *
    75  *  Input parameters:  NONE
    76  *
    77  *  Output parameters:  NONE
    78  *
    7946 *  INTERRUPT LATENCY:
    8047 *    dispatch thread
    8148 *    no dispatch thread
     
    9158  _ISR_Disable( level );
    9259  while ( _Thread_Dispatch_necessary == true ) {
    9360    heir = _Thread_Heir;
    94     _Thread_Dispatch_disable_level = 1;
     61   _Thread_Dispatch_set_disable_level( 1 );
    9562    _Thread_Dispatch_necessary = false;
    9663    _Thread_Executing = heir;
    9764
     
    185152  }
    186153
    187154post_switch:
    188   _Thread_Dispatch_disable_level = 0;
     155  _Thread_Dispatch_set_disable_level( 0 );
    189156
    190157  _ISR_Enable( level );
    191158
  • new file cpukit/score/src/threadenabledispatch.c

    RCS file: cpukit/score/src/threadenabledispatch.c
    diff -N cpukit/score/src/threadenabledispatch.c
    - +  
     1/*
     2 *   _Thread_Enable_dispatch
     3 *
     4 *
     5 *  COPYRIGHT (c) 1989-2011.
     6 *  On-Line Applications Research Corporation (OAR).
     7 *
     8 *  The license and distribution terms for this file may be
     9 *  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/score/thread.h>
     20
     21#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
     22  #include <rtems/score/timestamp.h>
     23#endif
     24
     25
     26/**
     27 *  The following declares the dispatch critical section nesting
     28 *  counter which is used to prevent context switches at inopportune
     29 *  moments.
     30 */
     31
     32/**
     33 *  _Thread_Enable_dispatch
     34 *
     35 *  This kernel routine exits a context switch disable critical section.
     36 *  This is the NOT INLINED version.
     37 *
     38 *  INTERRUPT LATENCY:
     39 *    dispatch thread
     40 *    no dispatch thread
     41 */
     42#if defined (__THREAD_DO_NOT_INLINE_ENABLE_DISPATCH__ )
     43void _Thread_Enable_dispatch( void )
     44{
     45  if ( --_Thread_Dispatch_disable_level )
     46    return;
     47  _Thread_Dispatch();
     48}
     49#endif
  • testsuites/support/include/tmacros.h

    RCS file: /usr1/CVS/rtems/testsuites/support/include/tmacros.h,v
    retrieving revision 1.55
    diff -u -r1.55 tmacros.h
     
    2525#include <string.h>
    2626#include <rtems/error.h>
    2727#include <rtems/score/thread.h> /*  _Thread_Dispatch_disable_level */
     28#include <rtems/score/thread.inl> /*  _Thread_Dispatch_disable_level */
    2829
    2930#ifdef __cplusplus
    3031extern "C" {
     
    4849#define check_dispatch_disable_level( _expect ) \
    4950  do { \
    5051    if ( (_expect) != -1 \
    51            && ((_Thread_Dispatch_disable_level == 0 && (_expect) != 0) \
    52              || (_Thread_Dispatch_disable_level != 0 && (_expect) == 0)) \
     52           && ((_Thread_Dispatch_in_critical_section() == false && (_expect) != 0) \
     53             || (_Thread_Dispatch_in_critical_section() && (_expect) == 0)) \
    5354    ) { \
    5455      printk( \
    5556        "\n_Thread_Dispatch_disable_level is (%" PRId32 \
    5657           ") not %d detected at %s:%d\n", \
    57          _Thread_Dispatch_disable_level, (_expect), __FILE__, __LINE__ ); \
     58         _Thread_Dispatch_get_disable_level(), (_expect), __FILE__, __LINE__ ); \
    5859      FLUSH_OUTPUT(); \
    5960      rtems_test_exit( 1 ); \
    6061    } \
  • testsuites/tmtests/tm26/task1.c

    RCS file: /usr1/CVS/rtems/testsuites/tmtests/tm26/task1.c,v
    retrieving revision 1.38
    diff -u -r1.38 task1.c
     
    453453
    454454  _Thread_Heir = _Thread_Executing;
    455455  _Thread_Dispatch_necessary = false;
    456   _Thread_Dispatch_disable_level = 0;
     456 
     457  _Thread_Dispatch_set_disable_level( 0 );
    457458
    458459  /*
    459460   *  Now dump all the times
  • testsuites/tmtests/tm27/task1.c

    RCS file: /usr1/CVS/rtems/testsuites/tmtests/tm27/task1.c,v
    retrieving revision 1.34
    diff -u -r1.34 task1.c
     
    111111
    112112  Interrupt_nest = 0;
    113113
    114   _Thread_Dispatch_disable_level = 0;
     114  _Thread_Dispatch_set_disable_level( 0 );
    115115
    116116  Interrupt_occurred = 0;
    117117
     
    144144   *  No preempt .. nested
    145145   */
    146146
    147   _Thread_Dispatch_disable_level = 1;
     147  _Thread_Dispatch_set_disable_level( 1 );
    148148
    149149  Interrupt_nest = 1;
    150150
     
    158158#endif
    159159  Interrupt_return_time = benchmark_timer_read();
    160160
    161   _Thread_Dispatch_disable_level = 0;
     161  _Thread_Dispatch_set_disable_level( 0 );
    162162
    163163  put_time(
    164164    "interrupt entry overhead: returns to nested interrupt",
     
    180180   *  Does a preempt .. not nested
    181181   */
    182182
    183   _Thread_Dispatch_disable_level = 0;
     183  _Thread_Dispatch_set_disable_level( 0 );
    184184
    185185  ready_queues      = (Chain_Control *) _Scheduler.information;
    186186  _Thread_Executing =
     
    241241   *  Switch back to the other task to exit the test.
    242242   */
    243243
    244   _Thread_Dispatch_disable_level = 0;
     244  _Thread_Dispatch_set_disable_level( 0 );
    245245
    246246  ready_queues      = (Chain_Control *) _Scheduler.information;
    247247  _Thread_Executing =
  • tools/schedsim/rtems/rtems_init.c

    RCS file: /usr1/CVS/rtems/tools/schedsim/rtems/rtems_init.c,v
    retrieving revision 1.1
    diff -u -r1.1 rtems_init.c
     
    101101  /*
    102102   *  Now we are back in a non-dispatching critical section
    103103   */
    104   _Thread_Dispatch_disable_level = 0;
     104  _Thread_Dispatch_set_disable_level( 0 );
    105105
    106106  /*
    107107   * Print an initial message