Subj : Re: JS_DestroyContext() access violation.. To : netscape.public.mozilla.jseng From : njaguar Date : Fri Feb 28 2003 09:42 am On Thu, 27 Feb 2003 22:39:37 -0800, Brendan Eich wrote: >>The application is multi-threaded, each script runs on it's own >>thread, but a single context never has more than one thread.. >By definition, a context cannot be used by more than one thread at a >time, in any embedding. No context is EVER used by more than one thread. In fact, they are never used by anything other than their original creating thread. >> I don't >>think this is a case of being multithreaded, > >It is. You must compile with JS_THREADSAFE defined, use NSPR for locks ...snip.. I'll check these links out, thanks for the info! >> but I really don't know.. >>It's quite odd, and happens somewhat randomly (and hasn't for quite >>some time actually...) It's almost like the Context isn't ready to be >>destroyed or something, or perhaps my js32.dll is ancient, and needs >>to be updated.. ;) >You're playing with fire if you use a thread-unsafe JS engine in >multiple threads. One context per thread at a time is the minimum, but >it doesn't protect you -- you need JS_THREADSAFE and the request model too. Again, I can't get the darned thing to compile! I put all the nspr stuff in the js src dir, add JS_THREADSAFE as a define, and it throws out tons of mac defines not found errors.. so either I gotta delete HUGE (and many) chunks of code to get it to compile (which I don't really want to deal with), or I gotta somehow find where those files are... They weren't included with the spidermonkey release, nor with the nspr release.. :( .