Commit d3f8b74c authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent a3810cc9
...@@ -45,6 +45,19 @@ BIND = IP_VERSION_FORMAT_DICT[ADDRESS_TYPE], 0 ...@@ -45,6 +45,19 @@ BIND = IP_VERSION_FORMAT_DICT[ADDRESS_TYPE], 0
LOCAL_IP = socket.inet_pton(ADDRESS_TYPE, IP_VERSION_FORMAT_DICT[ADDRESS_TYPE]) LOCAL_IP = socket.inet_pton(ADDRESS_TYPE, IP_VERSION_FORMAT_DICT[ADDRESS_TYPE])
# T1 T2
#
# __enter__
# __call__ (wait)
#
# __call__
# <--------- (wakeup T1)
# (sleep)
#
# __exit__
# (wakeup T2) ---------->
#
# both T1 & T2 run
class LockLock(object): class LockLock(object):
"""Double lock used as synchronisation point between 2 threads """Double lock used as synchronisation point between 2 threads
...@@ -76,6 +89,7 @@ class LockLock(object): ...@@ -76,6 +89,7 @@ class LockLock(object):
pass pass
# = FIFO lock
class FairLock(deque): class FairLock(deque):
"""Same as a threading.Lock except that waiting threads are queued, so that """Same as a threading.Lock except that waiting threads are queued, so that
the first one waiting for the lock is the first to get it. This is useful the first one waiting for the lock is the first to get it. This is useful
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment