fabiensanglard / cpsb

The book of CPS-1
MIT License
110 stars 34 forks source link

Sound "Thread" does not wait for interrupt increased intCounter counter (page 177) #156

Closed stefano-leone closed 1 year ago

stefano-leone commented 1 year ago

It seems there is an error in the C code on page 177.

Actually it is: while (musCounter < intCounter) {}

It should be: while (musCounter >= intCounter) {}

Reasoning: While (musCounter >= intCounter) the main flow actively waits. It executes one step when the interrupt increments intCounter, that is when musCounter becomes < intCounter.

fabiensanglard commented 1 year ago

Fixed in 76ecef54425b3b5e904d06711af5e26283859181