cybertiger, on Jan 11 2010, 10:11 PM, said:
There's only two threads in the code, as far as I know.
Yes, which is why bothering with atomic recursive locking in PCM_Lock/PCM_Unlock is pointless since the worker thread will never access these functions.
cybertiger, on Jan 11 2010, 10:11 PM, said:
Regards the thread safety and lack of synchronization anything called from fillData() is also going to be on the audio thread. I am thinking specifically of MV_MixCallBack() which in turn calls FX_CallBack(), which in turn calls S_TestSoundCallback(). These are all called with the sound lock held.
Right, the code in S_TestSoundCallback() is written with that in mind.
cybertiger, on Jan 11 2010, 10:11 PM, said:
Now any state these functions access is shared between two threads, and when the state is state is accessed from the main thread the sound lock should be obtained first, and in the vast majority of cases it is not.
Which exact state are you talking about? Can you describe a precise case where concurrent access to this shared state would result in a crash? Or even unwanted behavior?
cybertiger, on Jan 11 2010, 10:11 PM, said:
Given there's only two threads and one lock, in theory getting deadlocks should be impossible (you need a minimum of 2 threads and 2 locks for this).
Yes.
cybertiger, on Jan 11 2010, 10:11 PM, said:
I'll turn core dumps on and run against latest svn to see if I can obtain backtraces for you, in theory they should happen at points where the shared state I listed is accessed, if they don't overwrite the stack with junk before crashing.
Core dumps won't help, but be sure to `make veryclean && make RELEASE=0`. Also, changing sdlayer.c:585 to "#if 0" should help with dealing with gdb and EDuke32 at the same time. I still don't think you're going to run in any (related) crashes, though.