I don't check for InFuzzingThread() in Windows, since the AlarmHandler() is executed by a thread from a thread pool.
I continue thinking that it would be better to take the same approach for both Windows and Linux and execute that callbacks in a different thread in Linux too, instead of relying on asynchronous execution (as mentioned in https://reviews.llvm.org/D27240). We would avoid this kind of problems.
Thanks,
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Is the code already re-entrant for Windows so that it will work properly? No locks or guards are added, just a check that allows the code to continue even though we're in a different thread. Is this going to ahve unintended side effects that haven't been addressed?
@zturner Yes, I disable the check for InFuzzingThread() on Windows, because AlarmCallback() is always executed on a different thread. If I don't add these changes, the alarm handler will never execute.
As I mentioned in https://reviews.llvm.org/D27240, we could have some problems because we don't synchronize with the main thread. But we decided to ignore them.
In fact, we can't fix that because the same function AlarmCallback() will be called asynchronously for linux, so we can't use locks or anything like that.