summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-08-18 18:31:58 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-08-18 18:31:58 (GMT)
commit82aa2010229a9305cd95a1f66acd8a0f5986cb85 (patch)
tree082157d6be019816aa6eb00711e4482655bad73c
parentd810626f99e7033f8e2ea3506f6430bc9b261d0a (diff)
downloadcpython-82aa2010229a9305cd95a1f66acd8a0f5986cb85.zip
cpython-82aa2010229a9305cd95a1f66acd8a0f5986cb85.tar.gz
cpython-82aa2010229a9305cd95a1f66acd8a0f5986cb85.tar.bz2
patch up multiprocessing until it's API can be changed too
-rw-r--r--Lib/multiprocessing/dummy/__init__.py8
-rw-r--r--Lib/multiprocessing/managers.py2
-rw-r--r--Lib/multiprocessing/pool.py8
-rw-r--r--Lib/test/test_multiprocessing.py10
4 files changed, 17 insertions, 11 deletions
diff --git a/Lib/multiprocessing/dummy/__init__.py b/Lib/multiprocessing/dummy/__init__.py
index be1bf4a..f12ac11 100644
--- a/Lib/multiprocessing/dummy/__init__.py
+++ b/Lib/multiprocessing/dummy/__init__.py
@@ -54,10 +54,10 @@ class DummyProcess(threading.Thread):
return None
is_alive = threading.Thread.is_alive.im_func
- get_name = threading.Thread.get_name.im_func
- set_name = threading.Thread.set_name.im_func
- is_daemon = threading.Thread.is_daemon.im_func
- set_daemon = threading.Thread.set_daemon.im_func
+ get_name = threading.Thread.getName.im_func
+ set_name = threading.Thread.setName.im_func
+ is_daemon = threading.Thread.isDaemon.im_func
+ set_daemon = threading.Thread.setDaemon.im_func
#
#
diff --git a/Lib/multiprocessing/managers.py b/Lib/multiprocessing/managers.py
index 160c1cc..6f0cc7d 100644
--- a/Lib/multiprocessing/managers.py
+++ b/Lib/multiprocessing/managers.py
@@ -154,7 +154,7 @@ class Server(object):
except (OSError, IOError):
continue
t = threading.Thread(target=self.handle_request, args=(c,))
- t.set_daemon(True)
+ t.daemon = True
t.start()
except (KeyboardInterrupt, SystemExit):
pass
diff --git a/Lib/multiprocessing/pool.py b/Lib/multiprocessing/pool.py
index 8aaec63..1d24691 100644
--- a/Lib/multiprocessing/pool.py
+++ b/Lib/multiprocessing/pool.py
@@ -99,15 +99,15 @@ class Pool(object):
args=(self._inqueue, self._outqueue, initializer, initargs)
)
self._pool.append(w)
- w.set_name(w.get_name().replace('Process', 'PoolWorker'))
- w.set_daemon(True)
+ w.name = w.get_name().replace('Process', 'PoolWorker')
+ w.daemon = True
w.start()
self._task_handler = threading.Thread(
target=Pool._handle_tasks,
args=(self._taskqueue, self._quick_put, self._outqueue, self._pool)
)
- self._task_handler.set_daemon(True)
+ self._task_handler.daemon = True
self._task_handler._state = RUN
self._task_handler.start()
@@ -115,7 +115,7 @@ class Pool(object):
target=Pool._handle_results,
args=(self._outqueue, self._quick_get, self._cache)
)
- self._result_handler.set_daemon(True)
+ self._result_handler.daemon = True
self._result_handler._state = RUN
self._result_handler.start()
diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py
index 63e34c6..c3b1c82 100644
--- a/Lib/test/test_multiprocessing.py
+++ b/Lib/test/test_multiprocessing.py
@@ -619,11 +619,17 @@ class _TestCondition(BaseTestCase):
woken = self.Semaphore(0)
p = self.Process(target=self.f, args=(cond, sleeping, woken))
- p.set_daemon(True)
+ try:
+ p.set_daemon(True)
+ except AttributeError:
+ p.daemon = True
p.start()
p = threading.Thread(target=self.f, args=(cond, sleeping, woken))
- p.set_daemon(True)
+ try:
+ p.set_daemon(True)
+ except AttributeError:
+ p.daemon = True
p.start()
# wait for both children to start sleeping