@@ -20,15 +20,15 @@ def __init__(self):
2020 self .manager = multiprocessing .Manager ()
2121 self .shared_dict = SharedDict .get_instance ()
2222 cpu_count = multiprocessing .cpu_count ()
23- process_queue_list = []
23+ self . process_queue_list = []
2424 for _ in range (cpu_count ):
2525 q = multiprocessing .Queue ()
2626 new_worker = WorkerProcess (q )
2727 p = multiprocessing .Process (target = new_worker .run , args = ())
2828 p .start ()
29- process_queue_list .append ((p , q ))
29+ self . process_queue_list .append ((p , q ))
3030 self .process_picker = ProcessPicker .get_instance (
31- cpu_count , process_queue_list )
31+ cpu_count , self . process_queue_list )
3232
3333 def new_qubit (self , q_id ):
3434 """
@@ -46,8 +46,9 @@ def stop_all(self):
4646 """
4747 Stops the simulator from running.
4848 """
49- self .shared_dict .send_all_threads (None )
50- self .shared_dict .stop_all_threads ()
49+ for p , q in self .process_queue_list :
50+ q .put (None )
51+ p .join ()
5152 self .shared_dict .stop_shared_dict ()
5253 self .process_picker .stop_process_picker ()
5354
0 commit comments