Giter Site home page Giter Site logo

threadloop's Introduction

ThreadLoop

build-status coverage pypi

Run Tornado Coroutines from Synchronous Python.
from threadloop import ThreadLoop
from tornado import gen

@gen.coroutine
def coroutine(greeting="Goodbye"):
    yield gen.sleep(1)
    raise gen.Return("%s World" % greeting)

with ThreadLoop() as threadloop:
    future = threadloop.submit(coroutine, "Hello")

    print future.result() # Hello World

threadloop's People

Contributors

abhinav avatar blampe avatar eklitzke avatar hellograyson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

threadloop's Issues

Support other ioloops

Wondering if its possible to allow the ioloop to be injected... would need to either a common API to interact with them (start, stop, and add_callback). Or potentially Tornado's Twisted & AsyncIO bridge already works and we'd just provide documentation.

Add test verifying that main thread can exit

@abhinav thought we might be able to use multiprocessing to simulate the different use-cases.

  • when a script is ran, and the natural exit of the script is it finishing
  • when a signal is sent to the process, killing the process
  • when there is still work in flight in the ioloop

Documentation

Currently there isn't any documentation at all.

  • docblocks
  • README.md

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.