Closed theduke closed 3 years ago
You will need to show me your code, most likely you are trying to clone
the Mutable
while simultaneously holding a lock to it, which is not allowed.
Yes indeed, I was trying to clone inside signal_ref
.
That's a somewhat annoying limitation. I solved it by just wrapping in Rc<Mutable<_>>
, but why does cloning require a lock on the data?
And why is the panic so cryptic? Presumably because some RwLock
behaviour isn't implemented on Wasm?
That's a somewhat annoying limitation.
Yes it is, maybe I can fix it by using an AtomicUsize
, I'll investigate it.
but why does cloning require a lock on the data?
When you clone a Mutable
it has to increment a counter, so that way it knows how many copies there are. When all of the copies are dropped, it will then end the Signal.
And why is the panic so cryptic?
Exception handling isn't implemented in Wasm yet, so all error messages are just unreachable
.
You can improve the error messages by using this crate, but sometimes the error messages will still be bad.
I just published version 0.3.23
which makes clone
lock-free, so this problem should be fixed now.
Awesome, thanks!
I'm getting an unreachable panic in WASM when trying to clone a
Mutable
.