I
Iñaki Baz Castillo
Hi, I'm coding an async DNS resolver for EventMachine based on udns (a
C library).
In the Ruby C extension, when submitting a DNS query I pass the
current object (VALUE pointer) as an argument of the DNS query C
function.
Later on, when the DNS server replies, EventMachine (which watches on
the UDP socket of udns) invokes the C callback function belonging to
such query, and that callback includes the given VALUE as one of its
arguments. So I invoke a Ruby method for such VALUE (rb_funcall).
The problem is that the VALUE could be GC'ed (or being marked for so)
if the programmer assigns it to "nil" before the callback is executed,
so we get a coredump.
So when the callback is executed I need to check that the given VALUE
is still alive (not GC'ed neither marked for being GC'ed). How can I
inspect that? (I mean in C).
Thanks a lot.
--=20
I=C3=B1aki Baz Castillo
<[email protected]>
C library).
In the Ruby C extension, when submitting a DNS query I pass the
current object (VALUE pointer) as an argument of the DNS query C
function.
Later on, when the DNS server replies, EventMachine (which watches on
the UDP socket of udns) invokes the C callback function belonging to
such query, and that callback includes the given VALUE as one of its
arguments. So I invoke a Ruby method for such VALUE (rb_funcall).
The problem is that the VALUE could be GC'ed (or being marked for so)
if the programmer assigns it to "nil" before the callback is executed,
so we get a coredump.
So when the callback is executed I need to check that the given VALUE
is still alive (not GC'ed neither marked for being GC'ed). How can I
inspect that? (I mean in C).
Thanks a lot.
--=20
I=C3=B1aki Baz Castillo
<[email protected]>