-
Notifications
You must be signed in to change notification settings - Fork 22
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
Runtime::init is broken if called multiple times #39
Comments
@mrmr1993 that is correct, but it is exactly the behavior you get from See here at the end of the section:
|
I am even thinking that there is no need to track shutdowns, calling init more than once is just an error here, because you shouldn't ever have more than one owned instance of the runtime handle. So any call to |
I guess it should better return a |
For example,
Currently, the second call will be unable to use the OCaml runtime, because it has been shutdown at the end of the first call.
It seems
caml_startup
andcaml_shutdown
already handle this correctly: startup increments a counter, shutdown decrements it, and the runtime is only started or stopped when that counter is 0. Removing thestd::sync::Once
inRuntime::init_persistent
would restore this built-in behaviour, which seems to be strictly an improvement and fix this issue.The text was updated successfully, but these errors were encountered: