Module: xenomai-head
Branch: master
Commit: c01f892c5e670b22072cf12dfc2c1ffe06478225
URL:    
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=c01f892c5e670b22072cf12dfc2c1ffe06478225

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Wed Jun  3 15:53:44 2009 +0200

RTDM: Instrument rtdm_lock_get for proper use

In case the user thinks rtdm_lock_get could be used like spin_lock or
messes up the IRQ protection for other reasons, catch this with a
XENO_BUGON.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 include/rtdm/rtdm_driver.h |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/include/rtdm/rtdm_driver.h b/include/rtdm/rtdm_driver.h
index 058a9f8..5fc8b57 100644
--- a/include/rtdm/rtdm_driver.h
+++ b/include/rtdm/rtdm_driver.h
@@ -655,7 +655,15 @@ typedef unsigned long rtdm_lockctx_t;
  *
  * Rescheduling: never.
  */
+#ifdef DOXYGEN_CPP /* Beautify doxygen output */
 #define rtdm_lock_get(lock)    rthal_spin_lock(lock)
+#else /* This is how it really works */
+#define rtdm_lock_get(lock)                                    \
+       do {                                                    \
+               XENO_BUGON(RTDM, !rthal_local_irq_disabled());  \
+               rthal_spin_lock(lock);                          \
+       } while (0)
+#endif
 
 /**
  * Release lock without preemption restoration


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to