Interaction between CSpinLock and CLogger #367
-
As part of MiniDexed, there are several spinlocks created, but it would appear that in the MIDI driver after the MIDI spinlock has been acquired (https://github.com/probonopd/MiniDexed/blob/main/src/mididevice.cpp#L171) calls to any of the LOGn macros/functions no longer output to the display until the spinlock has been released. Is this expected behaviour? I see that the CLogger has its own spinlocks, so I guess my question really is - should different spinlocks be independent of each other? Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
In a multi-core environment acquiring a spin lock does two things:
Releasing the spin lock does this:
Because spin locks normally disable the IRQ, they should be held as short as possible. With the MiniDexed enables the Spin locks are independent regarding to its lock variable, but not to the execution level, which is set, when a spin lock is acquired. |
Beta Was this translation helpful? Give feedback.
In a multi-core environment acquiring a spin lock does two things:
IRQ_LEVEL
). This is the highest level, the spin lock can be acquired in the application. Raising the execution level prevents deadlocks, because when a spin lock is held and for example an IRQ occurs and the IRQ handler tries to acquire the same spin lock on the same core, this would freeze the system. So withIRQ_LEVEL
given to the constructor of a spin lock, IRQs are prohibited on this core as long this spin lock is acquired.