Discussion:
[rust-dev] Synchronizing with non-rust thread (async ffi callback)
Philippe
2014-09-18 20:00:56 UTC
Permalink
Hi again,

I think this is a bug in rust. Here is a minimal example attached.
Uncompress and type "make run".
On my debian amd64 unstable machine, I get:
fatal runtime error: assertion failed: !ptr.is_null()
Illegal instruction

I'm not sure how to report it, where should I upload the file?

Philippe
Hi,
http://doc.rust-lang.org/guide-ffi.html#asynchronous-callbacks . The
guide explains what to do but not how to do it. I tried to share a
Mutex between the rust thread and the c thread using combinations of
Arc, std::mem::drop and stuff, std::ptr::read and stuff. So far I got
only segfaults and assertion failures when I try to lock the mutex.
How are we supposed to send an object to a C callback and give it
ownership?
Also, there seems not to be Promise/Future classes in the standard
library, why is that?
Thanks,
Philippe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rustcrash.tar.bz2
Type: application/x-bzip2
Size: 814 bytes
Desc: not available
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140918/1301b191/attachment.bz2>
Philippe Daouadi
2014-09-30 18:33:42 UTC
Permalink
Hi,

The bug is reported here https://github.com/rust-lang/rust/issues/17485
but I got no answer. I just added the stack trace (thanks benjamin).

Philippe
Post by Philippe
Hi again,
I think this is a bug in rust. Here is a minimal example attached.
Uncompress and type "make run".
fatal runtime error: assertion failed: !ptr.is_null()
Illegal instruction
I'm not sure how to report it, where should I upload the file?
Philippe
Hi,
http://doc.rust-lang.org/guide-ffi.html#asynchronous-callbacks . The
guide explains what to do but not how to do it. I tried to share a
Mutex between the rust thread and the c thread using combinations of
Arc, std::mem::drop and stuff, std::ptr::read and stuff. So far I got
only segfaults and assertion failures when I try to lock the mutex.
How are we supposed to send an object to a C callback and give it
ownership?
Also, there seems not to be Promise/Future classes in the standard
library, why is that?
Thanks,
Philippe
Loading...