hi,
I was investigating a possible implementation of the "reset" method for
coroutine.pmc, but I encountered the following:
if the coroutine is called more times than the coroutine ".yield()s", it
segfaults
example:
.sub main :main
.local int result
.local pmc cor
cor = global "_foo"
result = cor()
print result # prints 1
print "\n"
result = cor()
print result # prints 2
print "\n"
result = cor()
print result # prints 3
print "\n"
result = cor()
print result # prints 4
print "\n"
result = cor()
print result #prints 5
print "\n"
result = cor()
print result # what should this do? start over again?
print "\n"
end
.end
.sub _foo
.yield(1)
.yield(2)
.yield(3)
.yield(4)
.yield(5)
#.yield(6)
.end
If the last .yield() is uncommented, it works, but otherwise, the last
result (5, in this case), is printed twice. Can this be a bug?
regards,
klaas-jan