Now that OpenBSD has an optimizing compiler maybe they will notice and fix dataraces in their pthread_mutex_lock implementation. Currently they use broken double-checked locking pattern when mutex is lazy initialized with PTHREAD_MUTEX_INITIALIZER.
[0] https://github.com/openbsd/src/blob/0ecb71b5ec9e4b22a484606f...
Next time, if you want to be sure we read about your problems with OpenBSD, please use sendbug(8) and fill a report[1] or come talk to us on tech@.
[0] -- https://marc.info/?l=openbsd-cvs&m=150131738906455&w=2