+ /* teardown counter thread */
+ act.sa_handler = SIG_IGN;
+ act.sa_flags = SA_RESTART;
+ ret = sigaction(SIGUSR2, &act, NULL);
+ if (ret == -1) {
+ perror("sigaction");
+ return -1;
+ }
+ {
+ char msg[1] = { 0x42 };
+ write(count_pipe[1], msg, 1); /* wakeup thread */
+ }
+ err = pthread_join(tid_count, &tret);
+ if (err != 0)
+ exit(1);
+
+ printf("Counting nodes... ");
+ fflush(stdout);
+ rcu_thread_online();
+ rcu_read_lock();
+ cds_lfht_count_nodes(test_ht, &approx_before, &count, &removed,
+ &approx_after);
+ rcu_read_unlock();
+ rcu_thread_offline();
+ printf("done.\n");
+ if (count || removed) {
+ printf("Approximation before node accounting: %ld nodes.\n",
+ approx_before);
+ printf("WARNING: nodes left in the hash table upon destroy: "
+ "%lu nodes + %lu logically removed.\n",
+ count, removed);
+ printf("Approximation after node accounting: %ld nodes.\n",
+ approx_after);
+ }
+ ret = cds_lfht_destroy(test_ht, NULL);
+ if (ret)
+ printf_verbose("final delete aborted\n");
+ else
+ printf_verbose("final delete success\n");