-
Currenty I'm developing Zenohex, Zenoh Elixir binding. We use Zenoh Query data on ErlangVM which Elixir runs on. Elixir doesn't have block scope, so we cannot control query's drop timing. Erlang VM's GC can release them, but we can't control the timing. ( In fact, we can by calling Therefore we can't control the timing of send_response_final which is called when query drops. So I would like to ask, is there way to use send_response_final before query dropping? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi there, To my knowledge, there isn't (nor should be) a way to do that. In general, Zenoh relies on destructors a lot, so I wouldn't recommend trying to bypass destructors, but rather see how you can ensure that they are called properly by your wrapper. The way we've done that in the Kotlin and Python bindings is that we generally store provide the binding objects with I'm not very familiar with Elixir, but if you want to avoid forcing the user to remember calling |
Beta Was this translation helpful? Give feedback.
Hi there,
To my knowledge, there isn't (nor should be) a way to do that. In general, Zenoh relies on destructors a lot, so I wouldn't recommend trying to bypass destructors, but rather see how you can ensure that they are called properly by your wrapper.
The way we've done that in the Kotlin and Python bindings is that we generally store provide the binding objects with
Option<T>
whereT
is the type that has useful drop behaviour. Then, the implementation ofclose()
for that binding object calls a rust function that callsOption::take
, allowingT
to be dropped properly.I'm not very familiar with Elixir, but if you want to avoid forcing the user to remember calling
query.send_final()
, a f…