I've got a rather large antlr4 parser that my company has traditionally used with the C#/Java runtimes. I'm exploring the C++ runtime, but running into problems when it comes to concurrently running instances of the parser.
I have no troubles when I run all of our test cases on a single thread, but when I try to distribute them over a thread pool, things get weird. I end up with segfaults, SIGABRTs, and spurious messages like:
terminate called without an active exception
pure virtual method called
terminate called recursively
When I wrap the parsing/analysis routine in a global mutex so that the parser instances are created one-at-a-time, but on different threads, there are no issues.
In all of these instances, the parser objects never leave the thread on which they're created.
Coming from the Java/C# ecosystems, I expected that separate instances of the parser would not interfere with each other from different threads. Is that not the case in the C++ target or am I doing something wrong?