[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [flashproxy/master] use with-syntax for locks



commit 7719078521bacddc4c33ccc7e7b0dcd92492ca27
Author: Ximin Luo <infinity0@xxxxxxx>
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 cf99141..647e1ed 100755
--- a/facilitator/facilitator
+++ b/facilitator/facilitator
@@ -93,12 +93,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, transports):



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits