- File:
-
- 1 edited
-
src/tests/concurrent/coroutineYield.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/tests/concurrent/coroutineYield.c
ref952d7 rb9da9585 4 4 #include <thread> 5 5 #include <time> 6 7 #define __kick_rate 150000ul8 #include "long_tests.h"9 6 10 7 #ifndef PREEMPTION_RATE … … 16 13 } 17 14 18 #ifdef TEST_LONG15 #ifdef LONG_TEST 19 16 static const unsigned long N = 600_000ul; 20 17 #else … … 26 23 void main(Coroutine& this) { 27 24 while(true) { 28 #if !defined(TEST_FOREVER) 29 sout | "Coroutine 1" | endl; 30 #endif 25 sout | "Coroutine 1" | endl; 31 26 yield(); 32 #if !defined(TEST_FOREVER) 33 sout | "Coroutine 2" | endl; 34 #endif 27 sout | "Coroutine 2" | endl; 35 28 suspend(); 36 29 } … … 40 33 int main(int argc, char* argv[]) { 41 34 Coroutine c; 42 for(int i = 0; TEST(i < N); i++) { 43 #if !defined(TEST_FOREVER) 44 sout | "Thread 1" | endl; 45 #endif 35 for(int i = 0; i < N; i++) { 36 sout | "Thread 1" | endl; 46 37 resume(c); 47 #if !defined(TEST_FOREVER) 48 sout | "Thread 2" | endl; 49 #endif 38 sout | "Thread 2" | endl; 50 39 yield(); 51 KICK_WATCHDOG;52 40 } 53 41 }
Note:
See TracChangeset
for help on using the changeset viewer.