threading-verification.py 文件源码

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

项目:biocommons.seqrepo 作者: biocommons 项目源码 文件源码
def fetch_in_thread(sr, nsa):
    """fetch a sequence in a thread

    """

    def fetch_seq(q, nsa):
        pid, ppid = os.getpid(), os.getppid()
        q.put((pid, ppid, sr[nsa]))

    q = Queue()
    p = Process(target=fetch_seq, args=(q, nsa))
    p.start()
    pid, ppid, seq = q.get()
    p.join()

    assert pid != ppid, "sequence was not fetched from thread"
    return pid, ppid, seq
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号