11 coreid::allocate_contiguous_aligned_block(unsigned n, unsigned alignment)
14 unsigned current = g_core_count.load(memory_order_acquire);
15 const unsigned rounded = slow_round_up(current, alignment);
16 const unsigned replace = rounded + n;
17 if (unlikely(replace > NMaxCores))
19 if (!g_core_count.compare_exchange_strong(current, replace, memory_order_acq_rel)) {
27 coreid::num_cpus_online()
29 const long nprocs = sysconf(_SC_NPROCESSORS_ONLN);
30 ALWAYS_ASSERT(nprocs >= 1);
34 __thread int coreid::tl_core_id = -1;
35 atomic<unsigned> coreid::g_core_count(0);