runserver.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:shelter 作者: seznam 项目源码 文件源码
def stop_child(http_server, parent_pid):
    """
    Tornado's callback function which checks PID of the parent process.
    If PID of the parent process is changed (parent has stopped), will
    stop **IOLoop**.
    """
    if os.getppid() != parent_pid:
        # Stop HTTP server (stop accept new requests)
        http_server.stop()
        # Stop IOLoop
        tornado.ioloop.IOLoop.instance().add_callback(
            tornado.ioloop.IOLoop.instance().stop)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号