Try to use pthread_set_name_np(3) (FreeBSD specific).