You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
327 B

# test _thread lock objects where a lock is acquired/released by a different thread
import _thread
def thread_entry():
print("thread about to release lock")
lock.release()
lock = _thread.allocate_lock()
lock.acquire()
_thread.start_new_thread(thread_entry, ())
lock.acquire()
print("main has lock")
lock.release()