I have trouble using std::sync::mpsc::channel in a callback from a native library.
The native library calls the same callback from multiple threads. The callback is a Rust closure that puts the data on a channel. When the sender is invoked a memory access violation happen in rustlib\src\rust\library\std\src\sync\mpsc\mod.rs(767).
I've written an isolated example of the issue:
You can start program with: cargo run --example testme
This is using rustc 1.47.0 (18bf6b4f0 2020-10-07)
Do you have any idea what may be wrong? Am I using the library wrong?