- dbg_printf("init hash entry: i %lu j %lu hash %lu\n",
- i, j, !i ? 0 : (1UL << (i - 1)) + j);
- new_node->p.reverse_hash =
- bit_reverse_ulong(!i ? 0 : (1UL << (i - 1)) + j);
- if (CMM_LOAD_SHARED(ht->in_progress_destroy))
- break;
+static
+void partition_resize_helper(struct cds_lfht *ht, unsigned long i,
+ unsigned long len,
+ void (*fct)(struct cds_lfht *ht, unsigned long i,
+ unsigned long start, unsigned long len))
+{
+ unsigned long partition_len;
+ struct partition_resize_work *work;
+ int cpu, ret;
+ pthread_t *thread_id;
+
+ /* Note: nr_cpus_mask + 1 is always power of 2 */
+ partition_len = len >> get_count_order_ulong(nr_cpus_mask + 1);
+ work = calloc(nr_cpus_mask + 1, sizeof(*work));
+ thread_id = calloc(nr_cpus_mask + 1, sizeof(*thread_id));
+ assert(work);
+ for (cpu = 0; cpu < nr_cpus_mask + 1; cpu++) {
+ work[cpu].ht = ht;
+ work[cpu].i = i;
+ work[cpu].len = partition_len;
+ work[cpu].start = cpu * partition_len;
+ work[cpu].fct = fct;
+ ret = pthread_create(&thread_id[cpu], ht->resize_attr,
+ partition_resize_thread, &work[cpu]);
+ assert(!ret);