commit d12075cffa76b634a3e7f7e290cc09a9b6e5684a Author: Ximin Luo infinity0@gmx.com Date: Mon Oct 7 12:08:45 2013 +0100
use with-syntax for locks --- facilitator/facilitator | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/facilitator/facilitator b/facilitator/facilitator index 7bb3819..27d0f02 100755 --- a/facilitator/facilitator +++ b/facilitator/facilitator @@ -71,12 +71,9 @@ def safe_str(s):
log_lock = threading.Lock() def log(msg): - log_lock.acquire() - try: + with log_lock: print >> options.log_file, (u"%s %s" % (time.strftime(LOG_DATE_FORMAT), msg)).encode("UTF-8") options.log_file.flush() - finally: - log_lock.release()
class TCPReg(object): def __init__(self, host, port):
tor-commits@lists.torproject.org