Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

thread safety #99

Open
dimzon opened this issue Feb 16, 2014 · 1 comment
Open

thread safety #99

dimzon opened this issue Feb 16, 2014 · 1 comment
Milestone

Comments

@dimzon
Copy link

dimzon commented Feb 16, 2014

Is there any proper way to compile JS function once and execute it in multiple threads?
I'm trying to catch function to variable - something like

        fn = (JSFunction) dynJS.evaluate(compilerScript,"\n;\n" +
                "(function(){return function(coffeeScriptSource, bare){return CoffeeScript.compile(coffeeScriptSource, {bare: !!bare});};})();" );

but invoking it in multiple threads produce exceptions

@lance lance added this to the 0.3 milestone Mar 6, 2014
@mschwartz
Copy link

new java.lang.Thread(function() {
  while (1) {
    java.lang.Thread.sleep(1000);
   console.log('thread alive');
  }
});

what happens if you start two threads that access the same global variables and functions?

Rhino handles this proper.

Nation does not.

I choose Rhino because of this, every time.

I'd love to use dynjs in my projects, but it's not quite there yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants