Simple attempt to create a text canvas that can be drawn to, then outputted as a string.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
506 B

import threading
class RAIILock:
def __init__(self, lock: threading.RLock, defer=False):
self.__lock = lock
self.__defer = defer
self.__acquired = False
def __enter__(self):
if self.__defer is False:
return self
def __exit__(self, exc_type, exc_val, exc_tb):
def acquire(self):
self.__acquired = True
def release(self):
if self.__acquired:
self.__acquired = False