Cleaner way to fix pthread-related unittest build issue