Statistics
| Branch: | Revision:

peerstreamer-logs-analyzer / lib / process_manager.py @ 1a481d7b

History | View | Annotate | Download (427 Bytes)

1 878b6653 Luca
import multiprocessing as mp
2
3
class ProcessManager:
4
5
        def __init__(self):
6
                self.ps_list = []
7
8
        def launchProcess(self,func,params=None):
9
        # shared has to be a object, params has to be a list
10
                if params is None:
11
                        params = []
12
13 1a481d7b Luca Baldesi
#                func(*params) ## sequential execution, for DEBUG
14 878b6653 Luca
                p = mp.Process(target = func,args=tuple(params))
15
                self.ps_list.append(p)
16
                p.start()
17
18
        def joinAll(self):
19
                for p in self.ps_list:
20
                        p.join()