source: src/tests/concurrent/coroutineYield.c @ 82c948c

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 82c948c was 82c948c, checked in by Thierry Delisle <tdelisle@…>, 6 years ago

Thread context switch no longer break coroutines.
Added corresponding test

  • Property mode set to 100644
File size: 319 bytes
Line 
1#include <fstream>
2#include <kernel>
3#include <stdlib>
4#include <thread>
5
6coroutine Coroutine {};
7
8void main(Coroutine& this) {
9        sout | "Coroutine 1" | endl;
10        yield();
11        sout | "Coroutine 2" | endl;
12}
13
14
15int main(int argc, char* argv[]) {
16        Coroutine c;
17        sout | "Thread 1" | endl;
18        resume(c);
19        sout | "Thread 2" | endl;
20}
Note: See TracBrowser for help on using the repository browser.