You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying out shuttle for https://github.com/anacrolix/possum. In some tests that are multithreaded, I need to call in to rusqlite code which then calls into C code which blocks the calling thread. After lots of trial and error I think I discovered that shuttle is not using native threads under the hood but its own kind of green threading. This doesn't play well with calling into code that hasn't been instrumented with shuttle primitives.
How can I call into that code? I was going to create a wrapper that spawned a native thread to run blocking code in rusqlite, then wait on the result from a shuttle mpsc channel but then I realised I can't send the result into a shuttle channel from a thread that wasn't created by shuttle.
The text was updated successfully, but these errors were encountered:
It sounds to me like this would work if you were to use a std::sync::mpsc channel to send results from the spawned thread to the main thread which is running under Shuttle. You would do the call to your wrapper, which would spawn a thread and give you a channel to block on. Your main thread would then block on the receiving end of the channel until the spawned thread is ready with the result. Does this work or am I missing something?
I'm trying out shuttle for https://github.com/anacrolix/possum. In some tests that are multithreaded, I need to call in to rusqlite code which then calls into C code which blocks the calling thread. After lots of trial and error I think I discovered that shuttle is not using native threads under the hood but its own kind of green threading. This doesn't play well with calling into code that hasn't been instrumented with shuttle primitives.
How can I call into that code? I was going to create a wrapper that spawned a native thread to run blocking code in rusqlite, then wait on the result from a shuttle mpsc channel but then I realised I can't send the result into a shuttle channel from a thread that wasn't created by shuttle.
The text was updated successfully, but these errors were encountered: