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

Exposing enif_schedule_nif #106

Closed
Qqwy opened this issue Jul 1, 2017 · 2 comments
Closed

Exposing enif_schedule_nif #106

Qqwy opened this issue Jul 1, 2017 · 2 comments

Comments

@Qqwy
Copy link
Contributor

Qqwy commented Jul 1, 2017

As stated in issue #44's discussion, enif_schedule_nif is currently not exposed by Rustler because it is not known how to expose the function in a compile-time safe way,

as the NIF is supposed to return to the Erlang scheduler right after enif_schedule_nif was called.

My proposal would be to expose enif_schedule_nif in an unsafe context, to ensure that people that want to use it are mindful of if they are using it in the proper way.

In the future, it might be possible to wrap enif_schedule_nif in some way.
An example would be as a preemptive Iterator-consumer, to ensure that the NIF will be split in chunks of O(1), even when performing O(n) or O(n^2) etc iterations.

@hansihe
Copy link
Member

hansihe commented Jul 3, 2017

I totally agree with this, if there is an API we can't expose safely, we should do it unsafely with warnings.

If you want to give this a go, I would be fully open to pull requests. I might give it a go next week after I am done with my talk at PolyConf.

@hansihe
Copy link
Member

hansihe commented Mar 8, 2019

Closing this issue in favour of #107, it contains more discussion

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

No branches or pull requests

2 participants