Home  >  Q&A  >  body text

并发 - python多进程/线程抢占stdoutput总是在固定位置截断上个输出?

迷茫迷茫2766 days ago384

reply all(1)I'll reply

  • 黄舟

    黄舟2017-04-18 10:15:11

    It is normal for multi-thread/process running output logs to be out of order. After all, when thread A is outputting logs, thread B may also be outputting. This will cause chaos. The solution can be to add a lock to the log function. Ensure the accuracy of log output. Don't get hung up on why high frequency occurs in a specific location, you also said it doesn't always happen after all. When to truncate is entirely the result of the thread running itself.

    reply
    0
  • Cancelreply