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).

  • 相关阅读:
    软件项目管理总体流程设计
    Delphi 编译时 提示 Internal error: URW3537 错误
    Oracle OLEDB 的手工分发
    Oracle10g Client的手工分发
    Delphi 处理在字符串截取中避免出现半个汉字
    Oracle ODP.Net 的手工分发
    项目中问题解决杂谈audio
    按钮 stylesheet 字符串;
    pb使用
    web测试和app测试的重点
  • 原文地址:https://www.cnblogs.com/rsapaper/p/8985192.html
Copyright © 2011-2022 走看看