summaryrefslogtreecommitdiffstatshomepage
path: root/tests/thread/thread_lock5.py
blob: 830b5efa82815c32853c6689fee3a40bd3303c62 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 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()