The following idioms appear a lot in the book "Advanced Programming in
the Unix Environment" by Stevens and Rago
Code:
int err
sigset_t oldmask;
pthread_t tid;
if ((err = pthread_sigmask(SIG_BLOCK, &mask, &oldmask)) ! = 0 )
err_exit(err, "SIG_BLOCK error");
err = pthread_create(&tid, NULL, thrd_fn, 0);
if(err != 0)
err_exit(err, "can't create thread");
The question is why don't do something like
Code:
if((err = pthread_create(&tid, NULL, thrd_fn, 0)) != 0)
err_exit(err, "can't create thread");
like what they do for pthread_sigmask()?