Value:{ \
<ENTER_ATOMIC_SECTION> \
code_block; \
<LEAVE_ATOMIC_SECTION> \
}
Execute code block atomically (DEPRECATED)
Generally, it is illegal to suspend the current task by calling rtdm_task_sleep(), rtdm_event_wait(), etc. while holding a spinlock. In contrast, this macro allows to combine several operations including a potentially rescheduling call to an atomic code block with respect to other RTDM_EXECUTE_ATOMICALLY() blocks. The macro is a light-weight alternative for protecting code blocks via mutexes, and it can even be used to synchronise real-time and non-real-time contexts.
- Parameters
-
code_block | Commands to be executed atomically |
- Note
- It is not allowed to leave the code block explicitly by using
break
, return
, goto
, etc. This would leave the global lock held during the code block execution in an inconsistent state. Moreover, do not embed complex operations into the code bock. Consider that they will be executed under preemption lock with interrupts switched-off. Also note that invocation of rescheduling calls may break the atomicity until the task gains the CPU again.
- Tags
- unrestricted
- Deprecated:
- This construct will be phased out in Xenomai 3.0. Please use rtdm_waitqueue services instead.
- See also
- cobalt_atomic_enter().