File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 3535import os
3636import socket
3737import sys
38+ import threading
3839import weakref
3940
4041import mitogen .core
@@ -157,19 +158,22 @@ def cork(self):
157158 held. This will not return until each thread acknowledges it has ceased
158159 execution.
159160 """
161+ current = threading .currentThread ()
160162 s = mitogen .core .b ('CORK' ) * ((128 // 4 ) * 1024 )
161163 self ._rsocks = []
162164
163165 # Pools must be paused first, as existing work may require the
164166 # participation of a broker in order to complete.
165167 for pool in self .pools :
166168 if not pool .closed :
167- for x in range (pool .size ):
168- self ._cork_one (s , pool )
169+ for th in pool ._threads :
170+ if th != current :
171+ self ._cork_one (s , pool )
169172
170173 for broker in self .brokers :
171174 if broker ._alive :
172- self ._cork_one (s , broker )
175+ if broker ._thread != current :
176+ self ._cork_one (s , broker )
173177
174178 # Pause until we can detect every thread has entered write().
175179 for rsock in self ._rsocks :
You can’t perform that action at this time.
0 commit comments