Comments (22)
I am planning on refactor the coroutine-rs
library to work just like coroutine in Boost. That would provide more flexible APIs for you to define what user could do in your callback function.
from mioco.pre-0.9.
I don't know how boost one works, but what we need in essence is really a context state for each handler ability to switch to it and and get back. Alternatively an exposed scheduler API. So I can have one scheduler for each mioco server instance, and potentially user being able to use coroutines withing handlers, but without interfering with a mioco server scheduler state.
from mioco.pre-0.9.
Maybe you can put the Scheduler into a thread local structure.
a context state for each handler ability to switch to it and and get back
I think this is in the feature clonable-handler
.
from mioco.pre-0.9.
I thought clonable handler just gives me an ability to clone Closure handler. Which I already use.
I want to have more Schedulers on the same thread.
from mioco.pre-0.9.
I don't know what exactly you want. Maybe I should look deep into your source code.
from mioco.pre-0.9.
I don't think source will tell much. It's just, I would like to it to be possible to have a scheduler state that cannot be interfered from outside.
In mioco we have server, that is scheduling coroutines (handlers). It depends on coroutine_handle.resume()
jumping into handler, and coroutine::block()
in the handler to get back to server. If handlers code will start using coroutines on it's own, then there might be more runnable coroutines and then it all falls appart: eg. block()
will not get back to the server code, but instead resume some other coroutine that did yield()
before or something similar.
from mioco.pre-0.9.
Ok, I see. So you want to have a scheduler. Maybe you could redefine the spawn
function to restrict those new spawned coroutines to be managed inside the scheduler.
On the other hand, you could also reverse your architecture, which means that a server just one of the coroutines that running on the scheduler. I think you may be interested in this repo: https://github.com/zonyitoo/simplesched
from mioco.pre-0.9.
If I'm to work on this, I think I'm just going to get a context switch functionality.
from mioco.pre-0.9.
So, maybe I should expose the context API?
from mioco.pre-0.9.
That would be awesome. I've been looking into https://github.com/rustcc/coroutine-rs/blob/master/src/context.rs on how to plug mioco to it, but that's it.
from mioco.pre-0.9.
Please try to use this crate: https://github.com/zonyitoo/context-rs
Happy hacking :)
from mioco.pre-0.9.
Awesome! Thanks!
from mioco.pre-0.9.
context-rs was exactly what I needed!
from mioco.pre-0.9.
You may try the feature-fnbox
branch.
from mioco.pre-0.9.
@zonyitoo : What's the difference? What does it give me? :) . I see that "Send" from initfn is gone.
You want me to try to see if it works OK?
from mioco.pre-0.9.
This version uses the latest feature FnBox
in the libstd. So I can get rid of the Thunk
and Send
trait.
Please try whether it works Ok, I want to merge it into the master branch.
from mioco.pre-0.9.
Any reason you use internal libc? I thought we're supposed to use crates.io version, no?
from mioco.pre-0.9.
Just for historical reason, let me make some updates.
from mioco.pre-0.9.
Ready. Branch context-feature-fnbox. It works here. I like the fact that I don't have to fake Send now. But the additional feature
-s will prevent us from working on anything but nightly for a while.
from mioco.pre-0.9.
I can merge it as soon as you make it available on crates.io so it builds for everyone.
from mioco.pre-0.9.
I already merge it to the master branch, but since the simd
crate is not ready for pushing to crates.io, I have to wait ...
from mioco.pre-0.9.
No hurry. :)
from mioco.pre-0.9.
Related Issues (20)
- Optimising repeated select!s HOT 1
- Is `mioco::get_userdata` sound? HOT 17
- Error handling for TcpStream::connect to non-listening port HOT 3
- `Receiver` should not be always `Send` HOT 5
- Channel panics when mixing `recv()` and `select!` HOT 5
- `UnixListener` is not usable. HOT 2
- Implement `sync_channel`
- `select!` takes at least one tick, which is super slow.
- No way to cancel notifications - select! on a lot of channels in loop can accumulate tons of notifications. HOT 1
- Change the documentation to remove the need for Rust Nightly HOT 2
- Missing openwrt/mipsel support HOT 3
- Prevent using mioco types from multiple thread(coroutines) at the same time. HOT 3
- clear documentation on handling panics HOT 17
- Travis panic
- Test fail in 0.8.0 with rustc stable and beta HOT 1
- Mioco is blocked polling for IO while there are runnable tasks HOT 1
- Mioco compilation with channels and streams fails. HOT 6
- reader.try_read() blocks forever after reading a few bytes
- Colerr mioco-related crash on short program.
- program crashed when run long time HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mioco.pre-0.9.