diff options
Diffstat (limited to 'cpukit/score/include/rtems/score/coremutex.h')
-rw-r--r-- | cpukit/score/include/rtems/score/coremutex.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/cpukit/score/include/rtems/score/coremutex.h b/cpukit/score/include/rtems/score/coremutex.h index fb29a7df82..1b3a570aca 100644 --- a/cpukit/score/include/rtems/score/coremutex.h +++ b/cpukit/score/include/rtems/score/coremutex.h @@ -26,6 +26,8 @@ extern "C" { #include <rtems/score/threadq.h> #include <rtems/score/priority.h> #include <rtems/score/watchdog.h> +#include <rtems/score/interr.h> +#include <rtems/score/sysstate.h> /* * The following type defines the callout which the API provides @@ -152,6 +154,7 @@ void _CORE_mutex_Initialize( * a macro that uses two support routines. */ + #ifndef __RTEMS_APPLICATION__ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock( CORE_mutex_Control *the_mutex, @@ -166,6 +169,15 @@ void _CORE_mutex_Seize_interrupt_blocking( #define _CORE_mutex_Seize( \ _the_mutex, _id, _wait, _timeout, _level ) \ do { \ + if ( _Thread_Dispatch_disable_level \ + && (_wait) \ + && (_System_state_Get() >= SYSTEM_STATE_BEGIN_MULTITASKING ) \ + ) { \ + _Internal_error_Occurred( \ + INTERNAL_ERROR_CORE, \ + FALSE, \ + 18 /* called from wrong environment */); \ + } \ if ( _CORE_mutex_Seize_interrupt_trylock( _the_mutex, &_level ) ) { \ if ( !_wait ) { \ _ISR_Enable( _level ); \ |