示例#1
0
 def __init__(self, parent_proc=None, *args, **kwargs):
     # print("thread layer init")
     super().__init__(*args, **kwargs)
     if parent_proc is not None:
         self.thread = parent_proc.register_child_thread(self)
     else:
         self.create_thread()
         LayerManager.add_layer(self)
示例#2
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     ctx = multiprocessing.get_context('spawn')
     self.process = ctx.Process(target=self.run_proc)
     self.thread_layers = []
     LayerManager.add_layer(self)