[code.view]

[top] / python / PyMOTW / threading / threading_lock_reacquire.py

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2008 Doug Hellmann All rights reserved.
     #
     """Normal locks cannot be acquired more than once, even by the same thread
     """
     #end_pymotw_header
     
     import threading
     
     lock = threading.Lock()
     
     print 'First try :', lock.acquire()
     print 'Second try:', lock.acquire(0)
     

[top] / python / PyMOTW / threading / threading_lock_reacquire.py

contact | logmethods.com