14 _debugClient = None |
14 _debugClient = None |
15 _originalProcess = None |
15 _originalProcess = None |
16 _originalBootstrap = None |
16 _originalBootstrap = None |
17 |
17 |
18 |
18 |
19 # TODO: add support for start method 'forkserver' |
|
20 # TODO: add support for start method 'spawn' |
|
21 def patchMultiprocessing(module, debugClient): |
19 def patchMultiprocessing(module, debugClient): |
22 """ |
20 """ |
23 Function to patch the multiprocessing module. |
21 Function to patch the multiprocessing module. |
24 |
22 |
25 @param module reference to the imported module to be patched |
23 @param module reference to the imported module to be patched |
35 _originalProcess = module.process.BaseProcess |
33 _originalProcess = module.process.BaseProcess |
36 else: |
34 else: |
37 _originalProcess = module.Process |
35 _originalProcess = module.Process |
38 _originalBootstrap = _originalProcess._bootstrap |
36 _originalBootstrap = _originalProcess._bootstrap |
39 |
37 |
|
38 # TODO: implement a process tracer |
|
39 # i.e. report which processes are started |
40 class ProcessWrapper(_originalProcess): |
40 class ProcessWrapper(_originalProcess): |
41 """ |
41 """ |
42 Wrapper class for multiprocessing.Process. |
42 Wrapper class for multiprocessing.Process. |
43 """ |
43 """ |
44 def _bootstrap(self, *args, **kwargs): |
44 def _bootstrap(self, *args, **kwargs): |