[Python-checkins] cpython: Issue #19478: Make choice of semaphore prefix more flexible.
richard.oudkerk
python-checkins at python.org
Sat Nov 2 18:09:15 CET 2013
http://hg.python.org/cpython/rev/1b5506fc6a50
changeset: 86864:1b5506fc6a50
parent: 86858:fdc10b073e79
user: Richard Oudkerk <shibturn at gmail.com>
date: Sat Nov 02 17:05:07 2013 +0000
summary:
Issue #19478: Make choice of semaphore prefix more flexible.
files:
Lib/multiprocessing/process.py | 10 ++++++++--
Lib/multiprocessing/synchronize.py | 4 ++--
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/Lib/multiprocessing/process.py b/Lib/multiprocessing/process.py
--- a/Lib/multiprocessing/process.py
+++ b/Lib/multiprocessing/process.py
@@ -301,10 +301,16 @@
self._parent_pid = None
self._popen = None
self._config = {'authkey': AuthenticationString(os.urandom(32)),
- 'semprefix': 'mp'}
+ 'semprefix': '/mp'}
# Note that some versions of FreeBSD only allow named
- # semaphores to have names of up to 14 characters. Therfore
+ # semaphores to have names of up to 14 characters. Therefore
# we choose a short prefix.
+ #
+ # On MacOSX in a sandbox it may be necessary to use a
+ # different prefix -- see #19478.
+ #
+ # Everything in self._config will be inherited by descendant
+ # processes.
_current_process = _MainProcess()
diff --git a/Lib/multiprocessing/synchronize.py b/Lib/multiprocessing/synchronize.py
--- a/Lib/multiprocessing/synchronize.py
+++ b/Lib/multiprocessing/synchronize.py
@@ -115,8 +115,8 @@
@staticmethod
def _make_name():
- return '/%s-%s' % (process.current_process()._config['semprefix'],
- next(SemLock._rand))
+ return '%s-%s' % (process.current_process()._config['semprefix'],
+ next(SemLock._rand))
#
# Semaphore
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list