servo / rust-mozjs

DEPRECATED - moved to servo/mozjs instead.
Mozilla Public License 2.0
293 stars 122 forks source link

Call JS_ShutDown when all runtimes have been dropped. #344

Closed jdm closed 7 years ago

jdm commented 7 years ago

This will enable better investigation of Servo's shutdown behaviour, since currently all of the JS helper threads just sit there until process exit.


This change is Reviewable

jdm commented 7 years ago

r? @nox

nox commented 7 years ago

It is currently not possible to initialize SpiderMonkey multiple times (that is, calling JS_Init, then other JSAPI methods, then JS_ShutDown in that order, then doing so again). This restriction may eventually be lifted.

https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/JSAPI_reference/JS_ShutDown

jdm commented 7 years ago

Yes, this PR is made under the assumption that we do not create new Runtime objects after all existing Runtime objects have been dropped. I could make that explicit by panicking in Runtime::new or making it return a Result if you'd like.

nox commented 7 years ago

Yeah, such assumptions are bad in safe code.

jdm commented 7 years ago

Fixed.

nox commented 7 years ago

@bors-servo r+

jdm commented 7 years ago

@bors-servo: r=nox

bors-servo commented 7 years ago

:pushpin: Commit b991ef3 has been approved by nox

bors-servo commented 7 years ago

:hourglass: Testing commit b991ef317d6d5cbb5fc8ebbee3af04fd1439796f with merge 7f380abcbe02604cca5f28ff4175dff2a4f5555e...

bors-servo commented 7 years ago

:broken_heart: Test failed - status-travis

bors-servo commented 7 years ago

:sunny: Test successful - status-appveyor, status-travis Approved by: nox Pushing 7f380abcbe02604cca5f28ff4175dff2a4f5555e to master...

chrmod commented 7 years ago

This PR introduced a breaking change to rust-mozjs api.

Is there any publishing model you use, to help lock projects on certain version?

tschneidereit commented 7 years ago

Is there any publishing model you use, to help lock projects on certain version?

Not yet: mozjs shouldn't at all be considered stable at this point. Once it gets closer to 1.0, it'll start following semantic versioning.

chrmod commented 7 years ago

that is good to know, thanks. Is there anyway to track your progress? How far away you are from 1.0?

jdm commented 7 years ago

I would not bet on 1.0 being declared this year.

tschneidereit commented 7 years ago

I would not bet on 1.0 being declared this year.

Agreed, it's quite unlikely it'll get stabilized this year. The API is very likely to undergo substantial changes, with stabilization beginning late this year or in 2018.