Comment fonctionne la méthode start() de python multiprocessing.Process. En particulier, existe-t-il une documentation pour Process._bootstrap() & si oui où?python process._sbootstrap()/.start()
0
A
Répondre
0
Voici le code, directement à partir de mon Python 2.7 installer :
def _bootstrap(self):
from . import util
global _current_process
try:
self._children = set()
self._counter = itertools.count(1)
try:
sys.stdin.close()
sys.stdin = open(os.devnull)
except (OSError, ValueError):
pass
_current_process = self
util._finalizer_registry.clear()
util._run_after_forkers()
util.info('child process calling self.run()')
try:
self.run()
exitcode = 0
finally:
util._exit_function()
except SystemExit, e:
if not e.args:
exitcode = 1
elif type(e.args[0]) is int:
exitcode = e.args[0]
else:
sys.stderr.write(e.args[0] + '\n')
sys.stderr.flush()
exitcode = 1
except:
exitcode = 1
import traceback
sys.stderr.write('Process %s:\n' % self.name)
sys.stderr.flush()
traceback.print_exc()
util.info('process exiting with exitcode %d' % exitcode)
return exitcode
0
Je ne suis pas sûr que vous devez jouer avec _bootstrap. Si vous êtes à la recherche d'une idée de base sur la façon d'utiliser la classe Process, je prendrais un coup d'oeil:
+0
Merci Drew - ce sont d'excellentes intros mais je veux vraiment comprendre ce qui se passe sous le capot – tchaz
Quel est le problème avec la lecture de la source? –
Oui - désolé - c'est la réponse évidente & corerct – tchaz