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

caml_final_release is not declared in finalise.h #6434

Closed
vicuna opened this issue May 20, 2014 · 5 comments
Closed

caml_final_release is not declared in finalise.h #6434

vicuna opened this issue May 20, 2014 · 5 comments
Assignees

Comments

@vicuna
Copy link

vicuna commented May 20, 2014

Original bug ID: 6434
Reporter: @whitequark
Assigned to: @damiendoligez
Status: closed (set by @damiendoligez on 2016-04-05T14:06:10Z)
Resolution: not a bug
Priority: normal
Severity: minor
Category: runtime system and C interface

Bug description

Should be clear from subject.

@vicuna
Copy link
Author

vicuna commented May 21, 2014

Comment author: @damiendoligez

This is a primitive that you're supposed to call from OCaml, not from C, so it doesn't need to be declared in the .h. Do you have a use case for calling it from C?

@vicuna
Copy link
Author

vicuna commented May 21, 2014

Comment author: @whitequark

I think I did, but not I'm not sure. A previous design of finalizers in ocaml-zmq was supposed to have a finalizer that doesn't terminate for a long time. But we went away from that design already.

Generally, wouldn't the use cases for calling it from C be the same as for finalizers written in OCaml?

@vicuna
Copy link
Author

vicuna commented Jul 16, 2014

Comment author: @damiendoligez

There are two kinds of finalisers/finalizers:

Finalizers are written in C and used for custom objects.
Finalisers are written in OCaml and used with Gc.finalise.

caml_final_release is for the second kind. I suppose you might want to call it from a C primitive called by your OCaml finalisation function, but I don't see much use for that. At worst you can do it with a callback (!) or call it before you call your C primitive.

@vicuna
Copy link
Author

vicuna commented Jul 22, 2014

Comment author: @whitequark

Does caml_final_release not work with finalizers written in C? I don't see anything conceptually different between releasing the runtime from a C finalizer or OCaml finalizer.

@vicuna
Copy link
Author

vicuna commented Apr 5, 2016

Comment author: @damiendoligez

A C finalizer runs in the middle of garbage collection. That's definitely not a safe point for releasing the runtime.

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

2 participants