summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/coremutex.h
diff options
context:
space:
mode:
authorJennifer Averett <Jennifer.Averett@OARcorp.com>2011-08-02 13:59:48 +0000
committerJennifer Averett <Jennifer.Averett@OARcorp.com>2011-08-02 13:59:48 +0000
commit3c50a488e91f718fa245eb0ebe1e2d87f374b9d0 (patch)
treeea474a915557158d0ae2db383c33bed97e234ce3 /cpukit/score/include/rtems/score/coremutex.h
parent2011-08-02 Petr Benes <benesp16@fel.cvut.cz> (diff)
downloadrtems-3c50a488e91f718fa245eb0ebe1e2d87f374b9d0.tar.bz2
2011-08-02 Jennifer Averett <Jennifer.Averett@OARcorp.com>
* score/include/rtems/score/coremutex.h: Move check dispatch for seize into its own macro and add smp support.
Diffstat (limited to 'cpukit/score/include/rtems/score/coremutex.h')
-rw-r--r--cpukit/score/include/rtems/score/coremutex.h27
1 files changed, 21 insertions, 6 deletions
diff --git a/cpukit/score/include/rtems/score/coremutex.h b/cpukit/score/include/rtems/score/coremutex.h
index 82e078cc6c..30bc33cf65 100644
--- a/cpukit/score/include/rtems/score/coremutex.h
+++ b/cpukit/score/include/rtems/score/coremutex.h
@@ -8,7 +8,7 @@
*/
/*
- * COPYRIGHT (c) 1989-2009.
+ * COPYRIGHT (c) 1989-2011.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -339,6 +339,25 @@ void _CORE_mutex_Seize_interrupt_blocking(
Watchdog_Interval timeout
);
+
+/**
+ * @brief Sieze Interrupt Wrapper
+ *
+ * This macro is to verify that a mutex blocking seize is
+ * performed from a safe system state. For example, one
+ * cannot block inside an isr.
+ *
+ * @return this method returns true if dispatch is in an unsafe state.
+ */
+#ifdef RTEMS_SMP
+ #define _CORE_mutex_Check_dispatch_for_seize(_wait) 0
+#else
+ #define _CORE_mutex_Check_dispatch_for_seize(_wait) \
+ (_Thread_Dispatch_in_critical_section() \
+ && (_wait) \
+ && (_System_state_Get() >= SYSTEM_STATE_BEGIN_MULTITASKING))
+#endif
+
/**
* @brief Sieze Interrupt Wrapper
*
@@ -366,14 +385,10 @@ void _CORE_mutex_Seize_interrupt_blocking(
* * If the caller is willing to wait
* then they are blocked.
*/
-
#define _CORE_mutex_Seize_body( \
_the_mutex, _id, _wait, _timeout, _level ) \
do { \
- if ( _Thread_Dispatch_in_critical_section() \
- && (_wait) \
- && (_System_state_Get() >= SYSTEM_STATE_BEGIN_MULTITASKING ) \
- ) { \
+ if ( _CORE_mutex_Check_dispatch_for_seize(_wait) ) { \
_Internal_error_Occurred( \
INTERNAL_ERROR_CORE, \
false, \