我有一个等待信号上升的协程:
@cocotb.coroutine
def wait_for_rise(self):
yield RisingEdge(self.dut.mysignal)
我在我的 «main» 测试功能中启动它,如下所示:
mythread = cocotb.fork(wait_for_rise())
即使没有信号上升,我也想在一段时间后停止它。我试图“杀死”它:
mythread.kill()
但是会发生异常:
Send raised exception: 'RunningCoroutine' object has no attribute '_join'
File "/opt/cocotb/cocotb/decorators.py", line 121, in send
return self._coro.send(value)
File "/myproject.py", line 206, in i2c_read
wTXDRwthread.kill()
File "/opt/cocotb/cocotb/decorators.py", line 151, in kill
cocotb.scheduler.unschedule(self)
File "/opt/cocotb/cocotb/scheduler.py", line 453, in unschedule
if coro._join in self._trigger2coros:
是否有正确停止分叉协程的解决方案?