我有一个协程,等待信号上升:
@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:
有没有一种方法可以正确停止分叉的协程?
答案 0 :(得分:1)
这看起来与https://github.com/potentialventures/cocotb/issues/650中的问题相同-您可以订阅该问题,以在其状态更改时得到通知。