ch.py 文件源码

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

项目:YoshinonBot 作者: wien-subs 项目源码 文件源码
def deferToThread(self, callback, func, *args, **kw):
    """
    Defer a function to a thread and callback the return value.

    @type callback: function
    @param callback: function to call on completion
    @type cbargs: tuple or list
    @param cbargs: arguments to get supplied to the callback
    @type func: function
    @param func: function to call
    """
    def f(func, callback, *args, **kw):
      ret = func(*args, **kw)
      self.setTimeout(0, callback, ret)
    threading._start_new_thread(f, (func, callback) + args, kw)

  ####
  # Scheduling
  ####
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号