我正在尝试使用ctypes来处理Python包装器。修改制造商给出的示例,我将帧作为ctypes.结构对象,工作正常。但此对象无法序列化,因此无法为单独的进程设置队列。我试着用基于dill的感伤:
import ctypes
from pathos.helpers import mp
import time
#Define point structure
class HeliosPoint(ctypes.Structure):
#_pack_=1
# projector maximum seems to be uint12
_fields_ = [('x', ctypes.c_uint16),
('y', ctypes.c_uint16),
('r', ctypes.c_uint8),
('g', ctypes.c_uint8),
('b', ctypes.c_uint8),
('i', ctypes.c_uint8)]
frameType = HeliosPoint * 1000
def fill_queue_with_frames(Qf):
while 1:
frame = frameType()
Qf.put(frame)
frame_q = mp.Queue(1000)
ProcessB = mp.Process(target=fill_queue_with_frames, args=(frame_q,))
ProcessB.start()
使用pathos,我得到以下错误:
^{pr2}$这能解决吗?有没有其他方法可以在不序列化的情况下设置两个并发进程?在
实际上问题是你需要一个你没有定义的名字。在模块中添加以下内容:
这似乎可以解决取消拾取错误。在
相关问题 更多 >
编程相关推荐