diff -ur ../trunk/Doc/library/multiprocessing.rst ./Doc/library/multiprocessing.rst --- ../trunk/Doc/library/multiprocessing.rst 2009-03-28 11:07:49.000000000 +0100 +++ ./Doc/library/multiprocessing.rst 2009-03-28 11:45:48.000000000 +0100 @@ -1121,9 +1121,10 @@ ``current_process().authkey``. Otherwise *authkey* is used and it must be a string. - .. method:: start() + .. method:: start([initializer[, initargs]]) - Start a subprocess to start the manager. + Start a subprocess to start the manager. If *initializer* is not ``None`` + then the subprocess will call ``initializer(*initargs)`` when it starts. .. method:: serve_forever() diff -ur ../trunk/Lib/multiprocessing/managers.py ./Lib/multiprocessing/managers.py --- ../trunk/Lib/multiprocessing/managers.py 2009-03-28 11:07:50.000000000 +0100 +++ ./Lib/multiprocessing/managers.py 2009-03-28 11:51:31.000000000 +0100 @@ -475,7 +475,7 @@ dispatch(conn, None, 'dummy') self._state.value = State.STARTED - def start(self): + def start(self, initializer=None, initargs=()): ''' Spawn a server process for this manager object ''' @@ -488,7 +488,7 @@ self._process = Process( target=type(self)._run_server, args=(self._registry, self._address, self._authkey, - self._serializer, writer), + self._serializer, writer, initializer, initargs), ) ident = ':'.join(str(i) for i in self._process._identity) self._process.name = type(self).__name__ + '-' + ident @@ -509,10 +509,14 @@ ) @classmethod - def _run_server(cls, registry, address, authkey, serializer, writer): + def _run_server(cls, registry, address, authkey, serializer, writer, + initializer=None, initargs=()): ''' Create a server, report its address and run it ''' + if initializer is not None: + initializer(*initargs) + # create server server = cls._Server(registry, address, authkey, serializer)