tprint: use own locking.h instead of pthread directly