Subj : Re: Access violation in JavaScript-C 1.5 pre-release 5 2003-01-10 To : Rob Swindell From : Brendan Eich Date : Tue May 06 2003 04:12 pm >If the JS engine doesn't use any global or static variables, and a separate >runtime is used per thread, why would there be any "thread safety" issues? >Sorry for questioning your answer, but I just don't understand what >necessitates the requirement. :-) > > The deflated string cache. Because of very old (older than JS_THREADSAFE) API commitments in the form of JS_GetStringBytes and its many clients, that cache is global. Notice the lack of a cx or rt parameter to JS_GetStringBytes. >If a separate runtime is used per thread, no JS_BeginRequest/EndRequest >calls are required though, correct? > > Correct. But you can't share objects among runtimes, and you waste more memory on average than if you could share. So since you'll need JS_THREADSAFE anyway, why not use fewer (say, one) runtimes? /be .