Preemption
Preemption can also result in re-entrancy. How to deal with it? Assuming single-core systems there are two approaches:
-
Disable interrupts in
acquire
; re-enable them inrelease
. This means that the logging macros block higher priority interrupts. -
Have a separate logger per priority level.
acquire
andrelease
are now lock-free and don't block interrupts. This requires multiplexing in the transport.