zoukankan      html  css  js  c++  java
  • eventlet time sleep

    Monkeypatching the Standard Library

    The other way of greening an application is simply to monkeypatch the standard library. This has the disadvantage of appearing quite magical, but the advantage of avoiding the late-binding problem.

    eventlet.patcher.monkey_patch(os=None, select=None, socket=None, thread=None, time=None, psycopg=None)

    This function monkeypatches the key system modules by replacing their key elements with green equivalents. If no arguments are specified, everything is patched:

    import eventlet
    eventlet.monkey_patch()
    

    The keyword arguments afford some control over which modules are patched, in case that’s important. Most patch the single module of the same name (e.g. time=True means that the time module is patched [time.sleep is patched by eventlet.sleep]). The exceptions to this rule are socket, which also patches the ssl module if present; and thread, which patches thread, threading, and Queue.

    Here’s an example of using monkey_patch to patch only a few modules:

    import eventlet
    eventlet.monkey_patch(socket=True, select=True)
    
  • 相关阅读:
    spring aop
    spring Mybatis集成
    springDao的jdbctemplate
    spark介绍4(sparksql)ODBC(Windows)gc
    ssm集合的配置
    scala文件流操作,生成sparkpv,uv作业文件
    java数据库操作
    vue一键打包部署
    Vue 那些事
    CDN合集
  • 原文地址:https://www.cnblogs.com/lexus/p/1841549.html
Copyright © 2011-2022 走看看