Skip to content
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

Thread pools for callbacks #30

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Thread pools for callbacks #30

wants to merge 5 commits into from

Commits on Apr 29, 2016

  1. Make #on_data callbacks run in a thread pool

    Processing the data from a connection is usually the most time consuming part of a network client and currently great care needs to be taken to avoid doing that work on the reactor thread.
    
    This makes it so that the #on_data callbacks of connections are always called in a thread pool. The thread pool is injected into the reactor and shared between all connections.
    
    The only implementation available so far (and also what will be the default) is a null pool which runs the task on the calling thread. This is of course not different from how it currently works, which is the intention. Applications can implement their own thread pools (essentially any object that responds to `#submit(&task) ⇒ Future`).
    iconara committed Apr 29, 2016
    Configuration menu
    Copy the full SHA
    98d7f22 View commit details
    Browse the repository at this point in the history
  2. Return a failed future when a thread pool task raises

    Even the null pool must make sure not to raise from #submit
    iconara committed Apr 29, 2016
    Configuration menu
    Copy the full SHA
    fbd6bac View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    73a353f View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    357ccf1 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    651f86b View commit details
    Browse the repository at this point in the history