Changeset 175f9f4 for libcfa/src/concurrency/thread.cfa
- Timestamp:
- Jan 18, 2022, 1:16:23 PM (2 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- 1e8b4b49, adfd125
- Parents:
- 21a5bfb7 (diff), 91a72ef (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
r21a5bfb7 r175f9f4 10 10 // Created On : Tue Jan 17 12:27:26 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Dec 4 09:17:49 201913 // Update Count : 912 // Last Modified On : Thu Jan 13 20:11:55 2022 13 // Update Count : 42 14 14 // 15 15 … … 25 25 #include "invoke.h" 26 26 27 uint64_t thread_rand();27 extern uint32_t __global_random_seed; 28 28 29 29 //----------------------------------------------------------------------------- 30 30 // Thread ctors and dtors 31 void ?{}( thread$ & this, const char * const name, cluster & cl, void * storage, size_t storageSize ) with( this ) {31 void ?{}( thread$ & this, const char * const name, cluster & cl, void * storage, size_t storageSize ) with( this ) { 32 32 context{ 0p, 0p }; 33 33 self_cor{ name, storage, storageSize }; … … 45 45 preferred = ready_queue_new_preferred(); 46 46 last_proc = 0p; 47 random_state = __global_random_seed; 47 48 #if defined( __CFA_WITH_VERIFY__ ) 48 49 canary = 0x0D15EA5E0D15EA5Ep; … … 171 172 } 172 173 173 uint64_t thread_rand() { 174 disable_interrupts(); 175 uint64_t ret = __tls_rand(); 176 enable_interrupts(); 177 return ret; 178 } 174 //----------------------------------------------------------------------------- 175 #define GENERATOR LCG 176 177 void set_seed( uint32_t seed ) { 178 active_thread()->random_state = __global_random_seed = seed; 179 GENERATOR( active_thread()->random_state ); 180 } // set_seed 181 uint32_t prng( void ) { return GENERATOR( active_thread()->random_state ); } // [0,UINT_MAX] 179 182 180 183 // Local Variables: //
Note: See TracChangeset
for help on using the changeset viewer.