I'm running the same AFL file in multiple chart windows and a repeating exploration. This code sets static variables in a critical section so that the multiple threads don't interfere with each other.
Is there any risk of causing unhandled exceptions, or BSOD by doing this?
Static Variables are THREAD SAFE by design. All updates to single static variables via StaticVarSet and StaticVarAdd are atomic, out of the box. You don't need critical sections if you don't use multiple static vars with complex interdependencies between them.
Only if you have some blocks of static variables that are correlated with each other and must be updated at once as a block you would need critical section.
And no, you don't risk any unhandled exceptions or BSOD by using Static variables.
Just make sure that you are releasing critical section because otherwise the other party trying to get access might wait forever.