|
|
@ -35,6 +35,7 @@ Support for operating in a mixed threading/forking environment.
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import socket
|
|
|
|
import socket
|
|
|
|
import sys
|
|
|
|
import sys
|
|
|
|
|
|
|
|
import threading
|
|
|
|
import weakref
|
|
|
|
import weakref
|
|
|
|
|
|
|
|
|
|
|
|
import mitogen.core
|
|
|
|
import mitogen.core
|
|
|
@ -157,6 +158,7 @@ class Corker(object):
|
|
|
|
held. This will not return until each thread acknowledges it has ceased
|
|
|
|
held. This will not return until each thread acknowledges it has ceased
|
|
|
|
execution.
|
|
|
|
execution.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
current = threading.currentThread()
|
|
|
|
s = mitogen.core.b('CORK') * ((128 // 4) * 1024)
|
|
|
|
s = mitogen.core.b('CORK') * ((128 // 4) * 1024)
|
|
|
|
self._rsocks = []
|
|
|
|
self._rsocks = []
|
|
|
|
|
|
|
|
|
|
|
@ -164,11 +166,13 @@ class Corker(object):
|
|
|
|
# participation of a broker in order to complete.
|
|
|
|
# participation of a broker in order to complete.
|
|
|
|
for pool in self.pools:
|
|
|
|
for pool in self.pools:
|
|
|
|
if not pool.closed:
|
|
|
|
if not pool.closed:
|
|
|
|
for x in range(pool.size):
|
|
|
|
for th in pool._threads:
|
|
|
|
|
|
|
|
if th != current:
|
|
|
|
self._cork_one(s, pool)
|
|
|
|
self._cork_one(s, pool)
|
|
|
|
|
|
|
|
|
|
|
|
for broker in self.brokers:
|
|
|
|
for broker in self.brokers:
|
|
|
|
if broker._alive:
|
|
|
|
if broker._alive:
|
|
|
|
|
|
|
|
if broker._thread != current:
|
|
|
|
self._cork_one(s, broker)
|
|
|
|
self._cork_one(s, broker)
|
|
|
|
|
|
|
|
|
|
|
|
# Pause until we can detect every thread has entered write().
|
|
|
|
# Pause until we can detect every thread has entered write().
|
|
|
|