-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I know similar questions have been asked several times, but I couldn't find an answer in earlier threads. Is it safe to process several modules concurrently in different threads if they share the same LLVM context instance, i.e., is the context implementation thread-safe? Thanks and ciao, Mario -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJQB8WxAAoJEDv0fP6GapNt/UAIAIVA9+kMRvRdzn0JHioTgVgq 5vLyWUQ890nQWdgO9ANQdiv7kzIhD3IrRpD6TmTptliE38xkC0kKEhiqll/hystM JlaJA+lmebCanQ41Aup6yVD7MiJ1iO+MdsZBRuxnDDaIDD2kbJgOb3I50wk+T+Rj oeiI/kXia7Ykl0k2p1IkkgaHDnQABTo+C7hJ3ey8OFpkPf6N5QuqZqZbcmXwW7ln 8TBoWCzt/uL1PDPH+eCJONAS7QoIUJOStMZXPCRdR0MWXL8cXmJfYGDFDIEo8ZHL Fh+hmc0xIn6T0G48/olRC+JEXhZILd98wMzqdAWR62Cc/oVRcqWbHJ1qnYg672U=8q4C -----END PGP SIGNATURE-----
Mario Schwalbe wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi, > > I know similar questions have been asked several times, but I couldn't > find an answer in earlier threads. > > Is it safe to process several modules concurrently in different threads > if they share the same LLVM context instance, i.e., is the context > implementation thread-safe?Nope, you need one context per thread in the general case. Whether the context implementation itself is thread-safe is a separate issue (it isn't, but even if it were that wouldn't be enough). The issue is the LLVMContext-owned objects (non-GV Constant and Type) which have global state (eg. use lists) which aren't protected by locks. Nick
Hi Mario,> I know similar questions have been asked several times, but I couldn't > find an answer in earlier threads. > > Is it safe to process several modules concurrently in different threads > if they share the same LLVM context instance, i.e., is the context > implementation thread-safe?no, different threads should use different contexts, not share the same context. Ciao, Duncan.