source: src/tests/concurrent/coroutineYield.c @ da7fe39

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumwith_gc
Last change on this file since da7fe39 was 70969f8, checked in by Thierry Delisle <tdelisle@…>, 7 years ago

Updated longrun tests have a more consistent duration

  • Property mode set to 100644
File size: 513 bytes
RevLine 
[82c948c]1#include <fstream>
2#include <kernel>
3#include <stdlib>
4#include <thread>
5
[70969f8]6#ifdef LONG_TEST
7static const unsigned long N = 600_000ul;
8#else
9static const unsigned long N = 1_000ul;
10#endif
11
[82c948c]12coroutine Coroutine {};
13
14void main(Coroutine& this) {
[7323573]15        while(true) {
16                sout | "Coroutine 1" | endl;
17                yield();
18                sout | "Coroutine 2" | endl;
19                suspend();
20        }
[82c948c]21}
22
23
24int main(int argc, char* argv[]) {
25        Coroutine c;
[70969f8]26        for(int i = 0; i < N; i++) {
[7323573]27                sout | "Thread 1" | endl;
28                resume(c);
29                sout | "Thread 2" | endl;
30                yield();
31        }
[82c948c]32}
Note: See TracBrowser for help on using the repository browser.