TCC have a semaphore that should protect tcc when used by 2 different threads, and I think at some point it was possible to use tcc with 2 different instances. So if TCC crashes it's a bug. Are you on mob or using the last release Jonathan ? Because the semaphore was introduced after 0.9.27.
On Fri, Dec 4, 2020 at 9:16 PM Karl Yerkes <karl.yer...@gmail.com> wrote: > > Hi Jonathan -- > > I am responding because I've tried to use multiple instances of libtcc in > various threads. i am not a tiny CC developer. > > the short answer is no. libtcc is not designed to be reentrant. there is > global state that messes stuff up sometimes when you try to use multiple > instances simultaneously. > > there have been several attempts to move TCC in the direction of reentrancy, > but (to my knowledge) it has not happened yet. > > personally, i've had luck getting two instances working by linking both > statically and then dynamically in the same program. although, i'm not an > expert and i could just be getting lucky. i'm now working to a "one process > per two TCC instances" scheme. > > for more, search the email archives for reentrant. > > if i'm wrong about any of this, i hope someone with more knowledge will > correct me :) > > -- karl > > On Fri, Dec 4, 2020 at 6:07 AM Jonathan Levi <jonathanil...@gmail.com> wrote: >> >> I am using LibTCC to compile runtime defined functions for a rendering layer >> of a project of mine. I compile many of these functions in parallel. >> LibTCC is crashing with exit code -11, at what appears to be when execution >> is passed to LibTCC on multiple threads, at the same time. It happens when >> I try to compile multiple functions at the same time, or compile a function >> at the same time as calling another already compiled function. (Although >> calling multiple functions at the same time does not appear to exit.) >> >> Should LibTCC work in multiple threads? I wonder whether I am just missing >> a dependency. >> >> Thanks, >> Jonathan >> _______________________________________________ >> Tinycc-devel mailing list >> Tinycc-devel@nongnu.org >> https://lists.nongnu.org/mailman/listinfo/tinycc-devel > > _______________________________________________ > Tinycc-devel mailing list > Tinycc-devel@nongnu.org > https://lists.nongnu.org/mailman/listinfo/tinycc-devel _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel