Quickfix for coroutine child resume bug.

Jan-Paul Bultmann <[email protected]>
Newsgroups gmane.comp.lang.io
Message-ID <[email protected]>
Coroutine do(

recentInChain := method(self)
updateRecentInChain := method(
	child := if(call hasArgs, call evalArgAt(0), self)
	recentInChain = child
	if(parentCoroutine, parentCoroutine updateRecentInChain(child))
	self
	)
	
coroResume := getSlot("resume")

resume = method(
	currentCoroutine updateRecentInChain
	coroResume
	)
)

One would do:

o actorCoroutine recentInChain resumeLater

I know that there is a flaw, when one tries to resume the recentInChain of the currentCoro one will counter intuitively resume the one that was run before the one currently running.
This could be avoided by
resumeRecent = method(
	currentCoroutine updateRecentInChain
	recentInChain coroResume
)

and an equivalent for resumeLater.

But I think it would be way more handsome to create a willResume callback where we could put the recent tracking code, as well as other neat stuff :)

So what do you think?

Cheers Jan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.