File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ def __init__(self, lock=None):
7979 if lock is None :
8080 lock = Lock ()
8181 self ._lock = lock
82- self ._waiters = list ()
82+ self ._waiters = deque ()
8383
8484 def release (self ):
8585 self ._lock .release ()
@@ -146,7 +146,7 @@ def notify(self, n=1):
146146 # so here we assume this is thead-safe ! It wouldn't be in any other
147147 # language, but python it is.
148148 try :
149- self ._waiters .pop ( 0 ).release ()
149+ self ._waiters .popleft ( ).release ()
150150 except IndexError :
151151 pass
152152 else :
@@ -156,7 +156,7 @@ def notify(self, n=1):
156156 # to do that in a thread-safe fashion
157157 try :
158158 for i in range (min (n , len (self ._waiters ))):
159- self ._waiters .pop ( 0 ).release ()
159+ self ._waiters .popleft ( ).release ()
160160 # END for each waiter to resume
161161 finally :
162162 self .release ()
You can’t perform that action at this time.
0 commit comments