Open jeremyjh opened 5 years ago
This is why we can't just start up the runtime again when we've previously called JS_ShutDown.
I'm good with that as a constraint but I do need to be able to create multiple runtimes, that should be possible right?
I tried adding this as the first line to the test so that the runtime count does not drop to 0 but that results in a SEGV.
let _runtime = Runtime::new().unwrap();
Which is not to say that I would not accept pull requests to address this issue; just that https://github.com/servo/rust-mozjs/pull/344 was introduced to ensure that the runtime did actually shut down when there is no clear synchronization point when multiple threads are in use.
The easiest way to deal with your situation would be to create a global runtime that outlives every other one.
EDIT: which I see you did... that shouldn't crash :<
It seems
Runtime::new
can be called successfully only once on a thread.I get the
Err
result calling it a second time. This is on 0.9.2 on nightly-2018-10-12 on MacOS High Sierra.Running this test passes if assign() is called once, fails when called twice.