pth: Use barriers in pthread tests