Skip to content

Feature recentInChain #126

Open
wants to merge 9 commits into from

3 participants

@ghost
ghost commented Jul 25, 2011

This is a system to allow the convenient handling of coros.
It adresses a problem where stopping and resuming a coroutine by directly accessing it would fail, because it has produced a child and is not actually running.
This is the case for calling on the actorCoroutine while the actor is executing a method, when the coroutine is currently in exception handling code or when the stack of a coro has become to large.

Usage is as follows.

o := Object clone

o l := method(
    j := 1
    loop(
        writeln("object: " .. j)
        if( j%2==0, "object will pause now\n" print;pause) //will access the actorCoro offspring implicitly through currentCoroutine
        j = j + 1
    )
)

run := method(
    o @@l

    for(i,1,4,
    yield
        writeln("i: " .. i)
        if(i==2, o actorCoroutine recentInChain resumeLater; "\nobject should resume now\n" print) //here its resumed explicitly
    )

    return nil
)

run
@ghost ghost closed this Apr 30, 2012
@ghost ghost reopened this Jun 10, 2012
@stevedekorte
Owner

thanks for the request but github says it can't automerge - could you fix this and make another request? Thanks

@MrMormon
MrMormon commented Feb 1, 2016

I guess not.

@stevedekorte
Owner

I'd welcome anyone else's attempt at a automerge-able patch. I'd do it myself but I have limited time these day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.