On Wed, 7 Jan 2015 09:23:39, Jakub Jelinek wrote: > > But I really don't like the busy waiting. You essentially want something > like pthread_barrier_wait that libtsan isn't aware of, right? >
Yes. > As tsan is only supported on x86_64-linux (and in the future could be on > some other 64-bit linuxes), I wonder if we couldn't just simplify libgomp's > config/linux/bar* for that purpose - libtsan doesn't intercept syscall(3) > and doesn't intercept futex in particular, so we could have a busy waiting > free synchronization primitive. Or another option is to just dlopen > libpthread.so.0 and dlsym pthread_barrier_wait in it and use that, that way > libtsan won't intercept it either. > That would be the honey pot. But unfortunately I can't reach it. I tried this, cat barrier.h #include <dlfcn.h> static pthread_barrier_t barrier; static int (*barrier_wait)(pthread_barrier_t *); __attribute__((constructor(101))) void barrier_init() { pthread_barrier_init (&barrier, NULL, 2); barrier_wait = (int (*)(pthread_barrier_t *)) dlsym (dlopen ("pthread.so.0", RTLD_NOW), "pthread_barrier_wait"); } But dlsym gives me only a pointer to the tsan-interceptor. Bernd.