Having a calloc fail on my server should not be fatal.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
}
partition_len = len >> cds_lfht_get_count_order_ulong(nr_threads);
work = calloc(nr_threads, sizeof(*work));
- assert(work);
+ if (!work) {
+ dbg_printf("error allocating for resize, single-threading\n");
+ goto fallback;
+ }
for (thread = 0; thread < nr_threads; thread++) {
work[thread].ht = ht;
work[thread].i = i;
assert(!ret);
}
free(work);
+ return;
+fallback:
+ ht->flavor->thread_online();
+ fct(ht, i, 0, len);
+ ht->flavor->thread_offline();
}
/*