Is pthread_barrier_destroy making the wrong comparison?
+ if (barrier == THR_PSHARED_PTR) {
I think this should be *barrier.
Also, a general question: why not use some flag in the barrier (and other
objects) to indicate pshared, removing the need for __thr_pshared_offpage
except in init?
__Martin