Changeset 6a490b2 for tests/concurrent
- Timestamp:
- May 11, 2020, 1:53:29 PM (3 years ago)
- Branches:
- arm-eh, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 504a7dc
- Parents:
- b7d6a36 (diff), a7b486b (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. - Location:
- tests/concurrent
- Files:
-
- 5 added
- 5 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrent/.expect/monitor.txt
rb7d6a36 r6a490b2 1 40000001 3000000 -
tests/concurrent/coroutineYield.cfa
rb7d6a36 r6a490b2 33 33 sout | "Coroutine 2"; 34 34 #endif 35 suspend ();35 suspend; 36 36 } 37 37 } -
tests/concurrent/monitor.cfa
rb7d6a36 r6a490b2 29 29 30 30 void main( MyThread & this ) { 31 for(int i = 0; i < 1_000_000; i++) {31 for(int i = 0; i < 750_000; i++) { 32 32 increment( global ); 33 33 } -
tests/concurrent/multi-monitor.cfa
rb7d6a36 r6a490b2 11 11 12 12 void increment( monitor_t & mutex p1, monitor_t & mutex p2, int & value ) { 13 assert(active_thread() == get_monitor(p1)->owner); 14 assert(active_thread() == get_monitor(p2)->owner); 13 15 value += 1; 16 assert(active_thread() == get_monitor(p1)->owner); 17 assert(active_thread() == get_monitor(p2)->owner); 14 18 } 15 19 -
tests/concurrent/signal/block.cfa
rb7d6a36 r6a490b2 33 33 34 34 monitor global_data_t { 35 thread_desc* last_thread;36 thread_desc* last_signaller;35 $thread * last_thread; 36 $thread * last_signaller; 37 37 }; 38 38 … … 82 82 if( !is_empty( cond ) ) { 83 83 84 thread_desc* next = front( cond );84 $thread * next = front( cond ); 85 85 86 86 if( ! signal_block( cond ) ) { -
tests/concurrent/suspend_then.cfa
rb7d6a36 r6a490b2 1 1 #include <fstream.hfa> 2 2 #include <kernel.hfa> 3 #include <monitor.hfa>4 3 #include <thread.hfa> 5 4 #include <time.hfa> … … 10 9 #include "long_tests.hfa" 11 10 12 #ifndef PREEMPTION_RATE13 #define PREEMPTION_RATE 10`ms14 #endif15 16 11 Duration default_preemption() { 17 return PREEMPTION_RATE;12 return 0; 18 13 } 19 14 … … 26 21 #if !defined(TEST_FOREVER) 27 22 static inline void print(const char * const text ) { 28 write( STD ERR_FILENO, text, strlen(text) );23 write( STDOUT_FILENO, text, strlen(text) ); 29 24 } 30 25 #else … … 32 27 #endif 33 28 34 coroutine Coroutine {};29 generator Coroutine { int i; }; 35 30 36 31 volatile bool done = false; … … 49 44 50 45 void main(Coroutine& this) { 51 suspend(); 52 for(int i = 0; TEST(i < N); i++) { 46 this.i = 0; 47 suspend; 48 for(;TEST(this.i < N); this.i++) { 53 49 54 print("C - Suspending ");55 void publish(){56 print("C - Publishing ");50 print("C - Suspending\n"); 51 suspend{ 52 print("C - Publishing\n"); 57 53 assert(!the_cor); 58 54 store( this ); 59 55 } 60 suspend_then(publish);61 56 assert(!the_cor); 62 print("C oroutine 2");57 print("C - Back\n"); 63 58 KICK_WATCHDOG; 64 59 yield(); 65 60 } 66 61 done = true; 67 suspend ();62 suspend; 68 63 } 69 64 … … 77 72 if(!mine) continue; 78 73 79 print("T - took ");74 print("T - took\n"); 80 75 resume(*mine); 81 print("T - back");82 76 } 83 77 }
Note: See TracChangeset
for help on using the changeset viewer.