Stopping cocotb forked coroutine

703 views Asked by At

I have a coroutine that waiting for a signal rising :

@cocotb.coroutine
def wait_for_rise(self):
    yield RisingEdge(self.dut.mysignal)

I'm launching it in my «main» test function like it :

mythread = cocotb.fork(wait_for_rise())

I want to stop it after a while even if no signal rise happen. I tryed to «kill» it:

mythread.kill()

But exception happen :

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:

Is there a solution to stop forked coroutine properly ?

1

There are 1 answers

1
cmarqu On BEST ANSWER

This very much looks like it is the same problem as in https://github.com/potentialventures/cocotb/issues/650 - you can subscribe to the issue to be notified when its status changes.