Skip to content

Interaction between CSpinLock and CLogger #367

Answered by rsta2
diyelectromusic asked this question in Q&A
Discussion options

You must be logged in to vote

In a multi-core environment acquiring a spin lock does two things:

  • It raises the current execution level to the level, given in its constructor (by default 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 with IRQ_LEVEL given to the constructor of a spin lock, IRQs are prohibited on this core as long this spin lock is acquired.
  • A lock variable is tested and set in an atomic operation. The acquire operation spins in a loop until, it ca…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@diyelectromusic
Comment options

@diyelectromusic
Comment options

@rsta2
Comment options

@diyelectromusic
Comment options

Answer selected by diyelectromusic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants