Ignore:
Timestamp:
Sep 19, 2017, 3:56:00 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
f980549
Parents:
8f98b78 (diff), 39fea2f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/coroutine.c

    r8f98b78 r764e009  
    6565        this.errno_ = 0;
    6666        this.state = Start;
    67         this.starter = NULL;
     67        this.starter = this_coroutine;
    6868        this.last = NULL;
    6969}
     
    171171                suspend();
    172172        }
     173
     174        void __leave_coroutine(void) {
     175                coroutine_desc * src = this_coroutine;          // optimization
     176
     177                assertf( src->starter != 0,
     178                        "Attempt to suspend coroutine \"%.256s\" (%p) that does not have a starter.\n"
     179                        "Possible cause is a resume of a coroutine already destroyed or not yet constructed",
     180                        src->name, src );
     181                assertf( src->starter->state != Halted,
     182                        "Attempt by coroutine \"%.256s\" (%p) to suspend back to terminated coroutine \"%.256s\" (%p).\n"
     183                        "Possible cause is terminated coroutine's main routine has already returned.",
     184                        src->name, src, src->starter->name, src->starter );
     185
     186                CoroutineCtxSwitch( src, src->starter );
     187        }
    173188}
    174189
Note: See TracChangeset for help on using the changeset viewer.