forked from Imagelibrary/rtems
score: Delete _Assert_Thread_dispatching_repressed
Add _Debug_Is_thread_dispatching_allowed(). This makes it possible to assert the opposite. Use _ISR_Disable_without_giant()/_ISR_Enable_without_giant() to avoid misleading secondary assertion failures.
This commit is contained in:
@@ -331,7 +331,7 @@ libscore_a_SOURCES += src/apiext.c src/chain.c src/chainappend.c \
|
|||||||
src/chainextract.c src/chainget.c src/chaininsert.c \
|
src/chainextract.c src/chainget.c src/chaininsert.c \
|
||||||
src/chainappendempty.c src/chainprependempty.c src/chaingetempty.c \
|
src/chainappendempty.c src/chainprependempty.c src/chaingetempty.c \
|
||||||
src/chainnodecount.c \
|
src/chainnodecount.c \
|
||||||
src/assertthreaddispatchingrepressed.c \
|
src/debugisthreaddispatchingallowed.c \
|
||||||
src/interr.c src/isr.c src/wkspace.c src/wkstringduplicate.c
|
src/interr.c src/isr.c src/wkspace.c src/wkstringduplicate.c
|
||||||
libscore_a_SOURCES += src/profilingisrentryexit.c
|
libscore_a_SOURCES += src/profilingisrentryexit.c
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013 embedded brains GmbH. All rights reserved.
|
* Copyright (c) 2013-2014 embedded brains GmbH. All rights reserved.
|
||||||
*
|
*
|
||||||
* embedded brains GmbH
|
* embedded brains GmbH
|
||||||
* Dornierstr. 4
|
* Dornierstr. 4
|
||||||
@@ -39,15 +39,13 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Asserts that thread dispatching is repressed.
|
* @brief Returns true if thread dispatching is allowed.
|
||||||
*
|
*
|
||||||
* Thread dispatching can be repressed via _Thread_Disable_dispatch() or
|
* Thread dispatching can be repressed via _Thread_Disable_dispatch() or
|
||||||
* _ISR_Disable().
|
* _ISR_Disable().
|
||||||
*/
|
*/
|
||||||
#if defined( RTEMS_DEBUG )
|
#if defined( RTEMS_DEBUG )
|
||||||
void _Assert_Thread_dispatching_repressed( void );
|
bool _Debug_Is_thread_dispatching_allowed( void );
|
||||||
#else
|
|
||||||
#define _Assert_Thread_dispatching_repressed() ( ( void ) 0 )
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013 embedded brains GmbH. All rights reserved.
|
* Copyright (c) 2013-2014 embedded brains GmbH. All rights reserved.
|
||||||
*
|
*
|
||||||
* embedded brains GmbH
|
* embedded brains GmbH
|
||||||
* Dornierstr. 4
|
* Dornierstr. 4
|
||||||
@@ -21,17 +21,17 @@
|
|||||||
#include <rtems/score/threaddispatch.h>
|
#include <rtems/score/threaddispatch.h>
|
||||||
|
|
||||||
#if defined( RTEMS_DEBUG )
|
#if defined( RTEMS_DEBUG )
|
||||||
void _Assert_Thread_dispatching_repressed( void )
|
bool _Debug_Is_thread_dispatching_allowed( void )
|
||||||
{
|
{
|
||||||
bool dispatch_is_disabled;
|
bool dispatch_allowed;
|
||||||
ISR_Level level;
|
ISR_Level level;
|
||||||
Per_CPU_Control *per_cpu;
|
Per_CPU_Control *per_cpu;
|
||||||
|
|
||||||
_ISR_Disable( level );
|
_ISR_Disable_without_giant( level );
|
||||||
per_cpu = _Per_CPU_Get_by_index( _SMP_Get_current_processor() );
|
per_cpu = _Per_CPU_Get_by_index( _SMP_Get_current_processor() );
|
||||||
dispatch_is_disabled = per_cpu->thread_dispatch_disable_level != 0;
|
dispatch_allowed = per_cpu->thread_dispatch_disable_level == 0;
|
||||||
_ISR_Enable( level );
|
_ISR_Enable_without_giant( level );
|
||||||
|
|
||||||
_Assert( dispatch_is_disabled || _ISR_Get_level() != 0 );
|
return dispatch_allowed && _ISR_Get_level() == 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -100,7 +100,7 @@ void _SMP_Broadcast_message( uint32_t message )
|
|||||||
uint32_t ncpus = _SMP_Get_processor_count();
|
uint32_t ncpus = _SMP_Get_processor_count();
|
||||||
uint32_t cpu;
|
uint32_t cpu;
|
||||||
|
|
||||||
_Assert_Thread_dispatching_repressed();
|
_Assert( _Debug_Is_thread_dispatching_allowed() );
|
||||||
|
|
||||||
for ( cpu = 0 ; cpu < ncpus ; ++cpu ) {
|
for ( cpu = 0 ; cpu < ncpus ; ++cpu ) {
|
||||||
if ( cpu != self ) {
|
if ( cpu != self ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user