Build a thread-safe lock that the same thread can acquire multiple times
Constraints
Example
```python
import threading
lock = ReentrantLock()
def worker():
lock.acquire()
lock.acquire()
print(lock.locked) # True
print(lock.owner) # the calling thread's ident
lock.release()
print(lock.locked) # True
lock.release()
print(lock.locked) # False
threads = [threading.Thread(target=worker) for _ in range(2)]
for t in threads:
t.start()
for t in threads:
t.join()
```
Recent Submissions
No submissions yet — hit Run Tests to try!
Hints