-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a non-Send bound spawn method and Task implementation. #6
Comments
FWIW I also forked async-task, though I actually removed all cross-thread synchronization (atomics) and related Send bounds. |
Hi. I'm in the process of writing safe rust bindings for writing Weechat
plugins. Since the Weechat plugin API is inherently asynchronous albeit callback based I had the idea that it would be nice to be able to run rust futures inside of Weechat.
I used async-task to implement an executor that runs on the Weechat event loop rather easily, thanks for the awesome project.
Now to my problem, I have a bunch of Weechat objects that should only be used on the Weechat thread. Since Weechat is in no way thread safe all interaction with Weechat (e.g. printing messages in Weechat) needs to happen inside the Weechat thread.
Since our executor does run on the Weechat thread, futures that run on it should be able to use Weechat objects, but as Weechat isn't thread safe none of them should be marked as
Send
.What I would need to achieve this with async-task is a
Task
struct and aspawn()
method that are notSend
bound. I saw this issue on the async-std tracker, and it seems that I'm not the only one with such a requirement.I would assume that any C project that runs on some event loop might want to implement an event-loop local executor as well, provided that they are writing rust bindings.
For reference, my prototype executor implementation can be found
here. I'm using a forked version of async-task where I just removed the
Send
bounds.The text was updated successfully, but these errors were encountered: