Changeset cc7bbe6 for libcfa/src/concurrency/thread.cfa
- Timestamp:
- Feb 23, 2022, 11:24:34 AM (4 years ago)
- Branches:
- ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
- Children:
- 08ed947
- Parents:
- f5a51db (diff), 3a038fa (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/thread.cfa
rf5a51db rcc7bbe6 10 10 // Created On : Tue Jan 17 12:27:26 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jan 13 20:11:55202213 // Update Count : 4212 // Last Modified On : Sat Feb 12 15:24:18 2022 13 // Update Count : 66 14 14 // 15 15 … … 25 25 #include "invoke.h" 26 26 27 extern uint32_t __global_random_seed ;27 extern uint32_t __global_random_seed, __global_random_prime, __global_random_mask; 28 28 29 29 //----------------------------------------------------------------------------- … … 45 45 preferred = ready_queue_new_preferred(); 46 46 last_proc = 0p; 47 random_state = __global_random_ seed;47 random_state = __global_random_mask ? __global_random_prime : __global_random_prime ^ rdtscl(); 48 48 #if defined( __CFA_WITH_VERIFY__ ) 49 49 canary = 0x0D15EA5E0D15EA5Ep; … … 176 176 177 177 void set_seed( uint32_t seed ) { 178 active_thread()->random_state = __global_random_seed = seed; 179 GENERATOR( active_thread()->random_state ); 178 uint32_t & state = active_thread()->random_state; 179 state = __global_random_seed = seed; 180 GENERATOR( state ); 181 __global_random_prime = state; 182 __global_random_mask = true; 180 183 } // set_seed 181 uint32_t prng( void ) { return GENERATOR( active_thread()->random_state ); } // [0,UINT_MAX] 184 185 uint32_t prng( void ) { // [0,UINT_MAX] 186 uint32_t & state = active_thread()->random_state; 187 return GENERATOR( state ); 188 } // prng 182 189 183 190 // Local Variables: //
Note:
See TracChangeset
for help on using the changeset viewer.