我有一个主线程Cmd从运行cmd2。threading.Thread()这使我能够使用“实时”执行模拟来交互地启动新线程。每个时间步的模拟结果是put() in a multiprocessing.Queue(). Additionally I can start live plots using matplotlib.animate. I read matplotlib is not thread-safe, so the plots run as a multiprocessing.Process() and get() the simulation results from the queue.
Unfortunately, once items from the queue are collected, they are deleted from the queue and not available for other threads or processes. This means I can send data from the simulation threads to the plotting processes, but can't …