Changeset e1e8408
- Timestamp:
- Oct 31, 2017, 11:17:46 AM (7 years ago)
- 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:
- 0dc954b, 4cedd9f
- Parents:
- 5434d04
- Location:
- src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/bits/algorithms.h
r5434d04 re1e8408 112 112 static inline void __libcfa_small_sortN( void* * arr, size_t dim ); 113 113 114 forall( otype T | { int ?<?( T, T ); int ?>?( T, T ); })115 static inline void __libcfa_small_sort( T * arr, size_t dim ) {114 forall( dtype T ) 115 static inline void __libcfa_small_sort( T* * arr, size_t dim ) { 116 116 switch( dim ) { 117 117 case 1 : return; -
src/libcfa/stdlib
r5434d04 re1e8408 215 215 void rand48seed( long int s ); 216 216 char rand48( void ); 217 char rand48( char l , char u);217 char rand48( char lower_bound, char upper_bound ); 218 218 int rand48( void ); 219 219 unsigned int rand48( void ); 220 unsigned int rand48( unsigned int u );221 unsigned int rand48( unsigned int l , unsigned int u);220 unsigned int rand48( unsigned int upper_bound ); 221 unsigned int rand48( unsigned int lower_bound, unsigned int upper_bound ); 222 222 long int rand48( void ); 223 223 unsigned long int rand48( void ); 224 unsigned long int rand48( unsigned long int u );225 unsigned long int rand48( unsigned long int l , unsigned long int u);224 unsigned long int rand48( unsigned long int upper_bound ); 225 unsigned long int rand48( unsigned long int lower_bound, unsigned long int upper_bound ); 226 226 float rand48( void ); 227 227 double rand48( void ); -
src/tests/sched-ext-barge.c
r5434d04 re1e8408 42 42 void main( barger_t & this ) { 43 43 yield(); 44 while( barge( global ) ) { yield( ((unsigned)rand48()) % 10); }44 while( barge( global ) ) { yield( rand48(10) ); } 45 45 } 46 46 47 47 bool do_call( global_t & mutex this ) { 48 yield( ((unsigned)rand48()) % 10);48 yield(rand48(10)); 49 49 if( this.state != WAITFOR && !this.done && this.started ) { 50 50 serr | "Barging before caller detected" | endl; … … 57 57 thread caller_t {}; 58 58 void main( caller_t & this ) { 59 while( do_call(global) ) { yield( ((unsigned)rand48()) % 10); }59 while( do_call(global) ) { yield(rand48(10)); } 60 60 } 61 61 … … 63 63 this.started = true; 64 64 for( int i = 0; i < N; i++) { 65 yield( ((unsigned)rand48()) % 10);65 yield(rand48(10)); 66 66 this.state = WAITFOR; 67 67 waitfor(do_call, this) { -
src/tests/sched-ext-dtor.c
r5434d04 re1e8408 45 45 46 46 void main( dummy_t & this ) { 47 yield( ((unsigned)rand48()) % 10);47 yield(rand48(10)); 48 48 set_state( this, MAIN ); 49 49 waitfor( ^?{}, this ) { … … 58 58 for( int i = 0; i < N; i++ ){ 59 59 dummy_t dummy[4]; 60 yield( ((unsigned)rand48()) % 100);60 yield( rand48(100) ); 61 61 } 62 62 sout | "Stopping" | endl; -
src/tests/sched-ext-recurse.c
r5434d04 re1e8408 15 15 static const unsigned long N = 5_000ul; 16 16 17 static inline void rand_yield() { yield( ((unsigned)rand48()) % 10); }17 static inline void rand_yield() { yield(rand48(10)); } 18 18 19 19 enum state_t { FIRST, SECOND, THIRD, LAST, STOP }; … … 23 23 for (i = 0; i < 4; i++) 24 24 { 25 int j = ((unsigned)rand48()) % 4;25 int j = rand48(4); 26 26 enum state_t t = array[j]; 27 27 array[j] = array[i]; -
src/tests/sched-ext-when.c
r5434d04 re1e8408 15 15 static const unsigned long N = 4_998ul; 16 16 17 static inline void rand_yield() { yield( ((unsigned)rand48()) % 10); }17 static inline void rand_yield() { yield(rand48(10)); } 18 18 19 19 monitor global_t { -
src/tests/sched-ext.c
r5434d04 re1e8408 26 26 volatile bool done; 27 27 28 unsigned rand10() {29 return (unsigned)rand48() % 10;30 }31 32 28 //---------------------------------------------------------------------------------------------------- 33 29 // Acceptor … … 36 32 void do_wait( global_t * mutex a ) { 37 33 sout | "Waiting to accept" | endl; 38 yield( rand 10() );34 yield( rand48(10) ); 39 35 40 36 sout | "Accepting" | endl; -
src/tests/sched-int-barge.c
r5434d04 re1e8408 64 64 65 65 if( action == 0 ) { 66 c.do_signal = max( ((unsigned)rand48()) % 10, 1);67 c.do_wait1 = ((unsigned)rand48()) %(c.do_signal);68 c.do_wait2 = ((unsigned)rand48()) %(c.do_signal);66 c.do_signal = max( rand48(10), 1); 67 c.do_wait1 = rand48(c.do_signal); 68 c.do_wait2 = rand48(c.do_signal); 69 69 70 70 if(c.do_wait1 == c.do_wait2) sout | "Same" | endl; -
src/tests/sched-int-block.c
r5434d04 re1e8408 49 49 wait( &cond, (uintptr_t)this_thread ); 50 50 51 yield( ((unsigned)rand48()) % 10);51 yield( rand48(10) ); 52 52 53 53 if(a.last_thread != a.last_signaller || b.last_thread != b.last_signaller ) { … … 58 58 a.last_thread = b.last_thread = this_thread; 59 59 60 yield( ((unsigned)rand48()) % 10);60 yield( rand48(10) ); 61 61 } 62 62 … … 70 70 //------------------------------------------------------------------------------ 71 71 void signal_op( global_data_t & mutex a, global_data_t & mutex b ) { 72 yield( ((unsigned)rand48()) % 10);72 yield( rand48(10) ); 73 73 74 74 [a.last_thread, b.last_thread, a.last_signaller, b.last_signaller] = this_thread; … … 83 83 } 84 84 85 yield( ((unsigned)rand48()) % 10);85 yield( rand48(10) ); 86 86 87 87 if(a.last_thread != next || b.last_thread != next) { -
src/tests/sched-int-disjoint.c
r5434d04 re1e8408 88 88 signal( &cond, a, data ); 89 89 90 yield( (unsigned)rand48() % 10);90 yield( rand48(10) ); 91 91 92 92 //This is technically a mutual exclusion violation but the mutex monitor protects us -
src/tests/sched-int-wait.c
r5434d04 re1e8408 62 62 63 63 while( waiter_left != 0 ) { 64 unsigned action = (unsigned)rand48() % 4;64 unsigned action = rand48(4); 65 65 switch( action ) { 66 66 case 0:
Note: See TracChangeset
for help on using the changeset viewer.