Created
April 20, 2022 17:00
-
-
Save clayg/1e2e4cb8f9fd35032fb56358f93754ec to your computer and use it in GitHub Desktop.
See if green_existing_locks works?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import eventlet.patcher | |
eventlet.patcher.monkey_patch(thread=True) | |
import threading | |
def take_and_release(): | |
try: | |
logging._lock.acquire() | |
finally: | |
logging._lock.release() | |
assert logging._lock.acquire() | |
t = threading.Thread(target=take_and_release) | |
t.start() | |
t.join(timeout=1) | |
# we should timeout, and the thread is still blocking | |
assert t.isAlive() | |
logging._lock.release() | |
t.join(timeout=1) | |
assert not t.isAlive() | |
print('locking works') |
Submitted that as eventlet/eventlet#754 -- FWIW, if I add
eventlet.patcher._fix_py3_rlock(logging._lock)
right after monkey patching, this guy seems happy on older py3 versions.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you patch eventlet like
it can work on py310 -- but prior to that, those C RLocks don't show up in
gc.get_objects()
! See eventlet/eventlet#546