I've got some code that calls recv()
periodically (with a MSG_DONTWAIT
flag). I'm curious because profiling my code in vtune, I see a sigprocmask()
call associated with the recv()
, and it's taking a large portion of the total time to execute. I'm curious why recv()
is calling sigprocmask()
.
When working with TCP socket under linux, you'll receive SIGPIPE if the other side is closed unexpectedly.
Since you can mask this signal (most of the time, you'll handle the return value of 0 yourself, you don't care about this signal), I guess the system library checks for the signal state, and if masked, use a faster code path.
If not, it can't optimize.
BTW, you know about pselect() right ?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With