pinobatch / pently

Scalable music engine for NES games
zlib License
72 stars 4 forks source link

Document reentrancy and thread safety #2

Closed pinobatch closed 5 years ago

pinobatch commented 8 years ago

A lot of games run audio in the NMI handler, starting songs and playing sound effects in the main thread and updating the audio in the NMI thread. But if the NMI handler interrupts a half-finished pently_start_music or pently_start_sound call and calls pently_update_sound, it might start reading data out of la-la land. It's even worse if a pently_start_sound called by the drum channel interrupts a pently_start_sound called by the game. So we need to at least document what is safe and what is unsafe.