Why not just call pthread_self() once before the if/else block instead of in each clause?