zoukankan      html  css  js  c++  java
  • autoreload 线程 进程管理 并发的处理方法

    Django  autoreload  

    https://github.com/django/django/blob/9386586f31b8a0bccf59a1bff647cd829d4e79aa/django/utils/autoreload.py


    django/core/management/commands/runserver.py ---> handler = self.get_handler(*args, **options)
    run(self.addr, int(self.port), handler,
    ipv6=self.use_ipv6, threading=threading, server_cls=self.server_cls)----> django/dispatch/dispatcher.py ---> def init(self, providing_args=None, use_caching=False):
    """
    Create a new signal.
    providing_args
    A list of the arguments this signal can pass along in a send() call.
    """
    self.receivers = []
    if providing_args is None:
    providing_args = []
    self.providing_args = set(providing_args)
    self.lock = threading.Lock()
    self.use_caching = use_caching

    https://github.com/python/cpython/blob/master/Lib/socketserver.py


    For request-based servers (including socket-based):
    - how to handle multiple requests:
    - synchronous (one request is handled at a time)
    - forking (each request is handled by a new process)
    - threading (each request is handled by a new thread)


    # poll/select have the advantage of not requiring any extra file descriptor,
    # contrarily to epoll/kqueue (also, they require a single syscall).


    Another approach to handling multiple simultaneous requests in an
    environment that supports neither threads nor fork (or where these are
    too expensive or inappropriate for the service) is to maintain an
    explicit table of partially finished requests and to use a selector to
    decide which request to work on next (or whether to handle a new
    incoming request). This is particularly important for stream services
    where each client can potentially be connected for a long time (if
    threads or subprocesses cannot be used).

  • 相关阅读:
    js变量如何赋值给css使用?
    前端预览与下载PDF小结
    子组件如何改父组件传过来的值
    TensorRT转换时的静态模式与动态模式
    Linux:搭建GlusterFS文件系统
    OpenFeign传输文件MultipartFile
    Docker:commit、export、import、save、load命令的使用
    Git:代码版本回退
    docker安装Drools Workbench
    ArchLinux:Typora设置gitee图床
  • 原文地址:https://www.cnblogs.com/rsapaper/p/8985192.html
Copyright © 2011-2022 走看看