Closed okeuday closed 2 years ago
Yes, I am aware of this.
The implementation of exceptions in ATS2 is not thread-safe. The stack for handling exceptions is not thread-local; it is global. Therefore, only the main thread can make use of exceptions in ATS2.
@githwxi Ok, thank you for confirming that is the situation. I can avoid the problem.
When executing an executable with valgrind, it is able to detect an invalid read in threaded source code (using athreads/POSIX-threads) during an exception handling check. The output occurs in two separate threads at roughly the same time with:
I believe it is responsible for a SIGSEGV that occurs when the executable is ran without valgrind. The source code is: https://github.com/ats-lang/ATS-Postiats-release/blob/abca6113e4be7c7107b862312b993069dcc5d316/ccomp/runtime/pats_ccomp_exception.h#L136
You may already be aware of this issue. If you need to replicate it, I can provide instructions to recreate it.