Skip to content

Implement registering and calling stop callback of resources - #740

Closed
lilioid wants to merge 1 commit into
rusterlium:masterfrom
lilioid:resource-stop-callback
Closed

Implement registering and calling stop callback of resources#740
lilioid wants to merge 1 commit into
rusterlium:masterfrom
lilioid:resource-stop-callback

Conversation

@lilioid

@lilioid lilioid commented May 22, 2026

Copy link
Copy Markdown
Contributor

I have implemented a new stop() callback compatible with ErlNifResourceStop as an addition to the Resource trait.

This has been manually verified to work by implementing a small program on top of it.
The codegen for the #[resource_impl] macro also just works.

resolves #735

@filmor

filmor commented May 22, 2026

Copy link
Copy Markdown
Member

Thank you for this, I will incorporate these changes (sans the odd nif_version flag adjustment that I'm pretty certain is wrong...) into #738 which should implement the actual enif_select wrapper.

@lilioid

lilioid commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

sans the odd nif_version flag adjustment that I'm pretty certain is wrong...

Ahh yeah that must have slipped through from when I was confused about OTP vs. NIF versions (hence the #739 ).

Thank you for this, I will incorporate these changes into #738 which should implement the actual enif_select wrapper.

A safe wrapper is definitely the preferred way to go and whichever way you want to incorporate this works for me. This was just what I needed to get my things running 😅

@lilioid lilioid closed this May 22, 2026
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

Successfully merging this pull request may close these issues.

Add stop callback support for resources

2 participants