summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorKen Giusti <kgiusti@apache.org>2014-05-20 18:03:46 +0000
committerKen Giusti <kgiusti@apache.org>2014-05-20 18:03:46 +0000
commit3ec8d1428b918dd0bfb3adc2310ea2920b9368ce (patch)
tree2ff77e6ebfe032d2a8a9da3f71c9d2bf0a8e6bef /python
parentf0b88e7cd07532b5bdaf2b9445b74fc2e148a297 (diff)
downloadqpid-python-3ec8d1428b918dd0bfb3adc2310ea2920b9368ce.tar.gz
QPID-5637: reset Selector singleton across fork.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1596341 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python')
-rw-r--r--python/qpid/selector.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/python/qpid/selector.py b/python/qpid/selector.py
index ff94091da0..d2f4c1fc88 100644
--- a/python/qpid/selector.py
+++ b/python/qpid/selector.py
@@ -16,7 +16,7 @@
# specific language governing permissions and limitations
# under the License.
#
-import atexit, time, errno
+import atexit, time, errno, os
from compat import select, set, selectable_waiter
from threading import Thread, Lock
@@ -43,16 +43,18 @@ class Selector:
lock = Lock()
DEFAULT = None
+ _current_pid = None
@staticmethod
def default():
Selector.lock.acquire()
try:
- if Selector.DEFAULT is None:
+ if Selector.DEFAULT is None or Selector._current_pid != os.getpid():
sel = Selector()
atexit.register(sel.stop)
sel.start()
Selector.DEFAULT = sel
+ Selector._current_pid = os.getpid()
return Selector.DEFAULT
finally:
Selector.lock.release()