美文网首页
python with lock

python with lock

作者: 橙姜 | 来源:发表于2018-03-01 15:23 被阅读0次

    https://docs.python.org/2.5/whatsnew/pep-343.html

    The threading module's locks and condition variables also support the 'with' statement:

    lock = threading.Lock()
    with lock:
    # Critical section of code
    ...
    The lock is acquired before the block is executed and always released once the block is complete.

    相关文章

      网友评论

          本文标题:python with lock

          本文链接:https://www.haomeiwen.com/subject/nfngxftx.html