Re: Quickfix for coroutine child resume bug.

Jan-Paul Bultmann <[email protected]>
Newsgroups gmane.comp.lang.io
Message-ID <[email protected]>
Sorry, it's getting late over here, while toothbrushing the scales fell from my eyes.

Coroutine do(

recentInChain := method(self)
setRecentInChain := method(recent,
	recentInChain = recent
	if(parentCoroutine, parentCoroutine setRecentInChain(recent))
	self
	)
	
coroResume := getSlot("resume")

resume = method(
	setRecentInChain(self)
	coroResume
	)
)

this one of course doesn't have the delay problem it also basically has the same behavior as if it was done with willResume, which one could refactor easily into the code.

So this is my proposed solution to the problem. It might be slower than an all C version, but I prefer it to be all Io. I still have the hope that someday Io will be self hosting, once Loki gets really of the ground ^^.

Cheerio Jan

On May 27, 2011, at 1:34 AM, Jan-Paul Bultmann wrote:

> 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.