AllenNeuralDynamics / AllenNeuralDynamics/brainwasher

Cleanup `flowpath_lock` debug output

Offen
#21 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
0
Forks
1
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.