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

It is not documented what happens when you nest caml_acquire_runtime_system() #6048

Closed
vicuna opened this issue Jun 23, 2013 · 1 comment
Closed

Comments

@vicuna
Copy link

vicuna commented Jun 23, 2013

Original bug ID: 6048
Reporter: sesquized
Status: closed (set by @xavierleroy on 2015-12-11T18:19:57Z)
Resolution: not a bug
Priority: normal
Severity: minor
Category: documentation

Bug description

The section 19.10.1 of the manual describes the caml_acquire_runtime_system() and caml_release_runtime_system().

I don't see where the text addresses what happens if you call acquire more than once from the same thread.

I looked at the Windows code and it appeared that you just need to match the number of releases to the number of acquires and you can acquire the lock more than once safely. (But I'm not certain and don't know if it's true for other OSs/build environments.)

It would be good if the topic was explained specifically.

@vicuna
Copy link
Author

vicuna commented Jun 24, 2013

Comment author: @xavierleroy

The behavior is very much unspecified: under Windows, it might work because the master lock is reentrant, but under POSIX systems it is very likely to deadlock at the second caml_release_runtime_system(). So, don't do that.

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

No branches or pull requests

1 participant