Ignore:
Timestamp:
Feb 6, 2018, 10:29:44 AM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
5f95b5f
Parents:
82c948c
Message:

Extended test to allow preemption to occur

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/concurrent/coroutineYield.c

    r82c948c r7323573  
    77
    88void main(Coroutine& this) {
    9         sout | "Coroutine 1" | endl;
    10         yield();
    11         sout | "Coroutine 2" | endl;
     9        while(true) {
     10                sout | "Coroutine 1" | endl;
     11                yield();
     12                sout | "Coroutine 2" | endl;
     13                suspend();
     14        }
    1215}
    1316
     
    1518int main(int argc, char* argv[]) {
    1619        Coroutine c;
    17         sout | "Thread 1" | endl;
    18         resume(c);
    19         sout | "Thread 2" | endl;
     20        for(int i = 0; i < 1_000; i++) {
     21                sout | "Thread 1" | endl;
     22                resume(c);
     23                sout | "Thread 2" | endl;
     24                yield();
     25        }
    2026}
Note: See TracChangeset for help on using the changeset viewer.