【问题标题】:In python, how can I do a non-blocking system call?在 python 中,如何进行非阻塞系统调用?
【发布时间】:2009-10-23 14:09:03
【问题描述】:

在 Python 中,是否可以在不分叉线程的情况下进行非阻塞系统调用?即,我可以避免吗:

import thread
thread.start_new_thread(os.system,('cmd',))

【问题讨论】:

    标签: python


    【解决方案1】:

    使用subprocess 模块(Popen)并将结果写入文件。您可以“等待”子流程终止或继续其他业务并轮询文件中的结果等。

    【讨论】:

      猜你喜欢
      • 2012-06-19
      • 1970-01-01
      • 2020-02-16
      • 2018-06-11
      • 2017-10-03
      • 2014-07-15
      • 2010-12-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多