Changeset fe9468e2


Ignore:
Timestamp:
Dec 3, 2020, 3:18:55 PM (10 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast-unique-expr
Children:
0f88a225
Parents:
6011658
Message:

Added function thread_rand as a tls-safe version of tls_rand()

Location:
libcfa/src/concurrency
Files:
4 edited

Legend:

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

    r6011658 rfe9468e2  
    160160        static inline void process(struct io_uring_cqe & cqe ) {
    161161                struct io_future_t * future = (struct io_future_t *)(uintptr_t)cqe.user_data;
    162                 __cfadbg_print_safe( io, "Kernel I/O : Syscall completed : cqe %p, result %d for %p\n", future, cqe.res, data->thrd );
     162                __cfadbg_print_safe( io, "Kernel I/O : Syscall completed : cqe %p, result %d for %p\n", &cqe, cqe.res, future );
    163163
    164164                fulfil( *future, cqe.res );
     
    298298                __u32 mask = *ring.submit_q.mask;
    299299
    300                 disable_interrupts();
    301                         __u32 off = __tls_rand();
    302                 enable_interrupts( __cfaabi_dbg_ctx );
     300                __u32 off = thread_rand();
    303301
    304302                // Loop around looking for an available spot
     
    344342                __u32 ready_mask = ring.submit_q.ready_cnt - 1;
    345343
    346                 disable_interrupts();
    347                         __u32 off = __tls_rand();
    348                 enable_interrupts( __cfaabi_dbg_ctx );
     344                __u32 off = thread_rand();
    349345
    350346                __u32 picked;
  • libcfa/src/concurrency/io/call.cfa.in

    r6011658 rfe9468e2  
    8484
    8585                /* paranoid */ verifyf( cltr->io.ctxs, "default io contexts for cluster %p are missing\\n", cltr);
    86                 return &cltr->io.ctxs[ __tls_rand() % cltr->io.cnt ];
     86                return &cltr->io.ctxs[ thread_rand() % cltr->io.cnt ];
    8787        }
    8888#endif
  • libcfa/src/concurrency/kernel/fwd.hfa

    r6011658 rfe9468e2  
    132132                }
    133133
     134                extern uint64_t thread_rand();
     135
    134136                //-----------------------------------------------------------------------
    135137                // Statics call at the end of each thread to register statistics
  • libcfa/src/concurrency/thread.cfa

    r6011658 rfe9468e2  
    162162}
    163163
     164uint64_t thread_rand() {
     165        disable_interrupts();
     166        uint64_t ret = __tls_rand();
     167        enable_interrupts( __cfaabi_dbg_ctx );
     168        return ret;
     169}
     170
    164171// Local Variables: //
    165172// mode: c //
Note: See TracChangeset for help on using the changeset viewer.