AllenNeuralDynamics / AllenNeuralDynamics/brainwasher

Cleanup `flowpath_lock` debug output

Open
#21 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
0
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Acquiring the `RLock` should disambiguate if we have already acquired it and not print the same message.

We can do this with:
```python
import threading

rlock = threading.RLock()

# Check if we are acquiring it for the first time.
try:
if rlock.acquire(blocking=False): # reacquiring
fn()
else:
printf("rlock acquired for the first time.")
rlock.acquire() # First acquisition
fn()
finally:
rlock.release() # Release the initial acquisition
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.