Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/thread.cfa

    r5d1ebb9 r24e321c  
    1010// Created On       : Tue Jan 17 12:27:26 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jan 13 20:11:55 2022
    13 // Update Count     : 42
     12// Last Modified On : Wed Dec  4 09:17:49 2019
     13// Update Count     : 9
    1414//
    1515
     
    2525#include "invoke.h"
    2626
    27 extern uint32_t __global_random_seed;
     27uint64_t thread_rand();
    2828
    2929//-----------------------------------------------------------------------------
    3030// Thread ctors and dtors
    31 void ?{}( thread$ & this, const char * const name, cluster & cl, void * storage, size_t storageSize ) with( this ) {
     31void ?{}(thread$ & this, const char * const name, cluster & cl, void * storage, size_t storageSize ) with( this ) {
    3232        context{ 0p, 0p };
    3333        self_cor{ name, storage, storageSize };
     
    4545        preferred = ready_queue_new_preferred();
    4646        last_proc = 0p;
    47         random_state = __global_random_seed;
    4847        #if defined( __CFA_WITH_VERIFY__ )
    4948                canary = 0x0D15EA5E0D15EA5Ep;
     
    172171}
    173172
    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]
     173uint64_t thread_rand() {
     174        disable_interrupts();
     175        uint64_t ret = __tls_rand();
     176        enable_interrupts();
     177        return ret;
     178}
    182179
    183180// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.