]> granicus.if.org Git - python/commitdiff
Issue #19478: Make choice of semaphore prefix more flexible.
authorRichard Oudkerk <shibturn@gmail.com>
Sat, 2 Nov 2013 17:05:07 +0000 (17:05 +0000)
committerRichard Oudkerk <shibturn@gmail.com>
Sat, 2 Nov 2013 17:05:07 +0000 (17:05 +0000)
Lib/multiprocessing/process.py
Lib/multiprocessing/synchronize.py

index c2fc581b1f407d84ae6e72021d45dc23caa4631c..cd52736a70f316145adda687b13a92cdec7a05ee 100644 (file)
@@ -301,10 +301,16 @@ class _MainProcess(BaseProcess):
         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()
index 82c30a27a5e008285fcfc3a5449d1bdaec5f3e09..9d8e2824772e31e713fe95c383efa793a0a55145 100644 (file)
@@ -115,8 +115,8 @@ class SemLock(object):
 
     @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