From ff247b6862648b4582f847672df16a4b86145d46 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 2 Oct 2003 12:40:23 +0000 Subject: 2003-10-02 Phil Torre PR 504/rtems * include/rtems/score/coremutex.h: Add fatal error check for a task blocking on a mutex when thread dispatching is disabled. --- cpukit/score/ChangeLog | 6 ++++++ cpukit/score/include/rtems/score/coremutex.h | 12 ++++++++++++ 2 files changed, 18 insertions(+) (limited to 'cpukit/score') diff --git a/cpukit/score/ChangeLog b/cpukit/score/ChangeLog index a1f8857619..a46bb3ee47 100644 --- a/cpukit/score/ChangeLog +++ b/cpukit/score/ChangeLog @@ -1,3 +1,9 @@ +2003-10-02 Phil Torre + + PR 504/rtems + * include/rtems/score/coremutex.h: Add fatal error check for a task + blocking on a mutex when thread dispatching is disabled. + 2003-09-26 Joel Sherrill * cpu/hppa1.1/.cvsignore, cpu/hppa1.1/ChangeLog, 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 #include #include +#include +#include /* * 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 ); \ -- cgit v1.2.3