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

Is there some API like "select/poll/epoll_wait"? #14961

Closed
egmkang opened this Issue Jun 17, 2014 · 2 comments

Comments

Projects
None yet
3 participants
@egmkang

egmkang commented Jun 17, 2014

my application is something broadcast server, pseudo code like this:

BufferedSocket:
    vector<shared_ptr<Message>> messages_;
    OnRead():
        while(shared_ptr<Message> m = read())
            //this is important
            BroadMessageToAll(m)
    OnWrite():
        Buffer buffer = CombineMessageToBuffer(messages_)
            write(buffer)

EventLoop:
    vector<shared_ptr<BufferedSocket>> sockets = epoll_wait()
    for each socket in sockets:
        if socket.readable()
            socket.OnRead()
        if socket.writable()
            socket.OnWrite()

I want gather write option, call system call "write" once to send everything(maybe twice). that is what i do in cpp.
how can i do this thing in rust?
or there is a better way?

thanks a lot.

@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Jun 17, 2014

Member

We do not currently have an epoll/select abstraction. The current answer is "spawn a task per socket". Tracking select/epoll is done in #6842, so closing in favor of that issue.

Member

alexcrichton commented Jun 17, 2014

We do not currently have an epoll/select abstraction. The current answer is "spawn a task per socket". Tracking select/epoll is done in #6842, so closing in favor of that issue.

@steveklabnik

This comment has been minimized.

Show comment
Hide comment
@steveklabnik

steveklabnik Jan 12, 2017

Member

Today, https://tokio.rs/ is what you'd use.

Member

steveklabnik commented Jan 12, 2017

Today, https://tokio.rs/ is what you'd use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment