Я тут случайно почитал про recv в gnu libс manual http://www.gnu.org/software/libc/manual/html_node/Receiving-Data.html#Receivi...
Натолкнувшись вот на этот абзац
== This function is defined as a cancellation point in multi-threaded programs, so one has to be prepared for this and make sure that allocated resources (like memory, files descriptors, semaphores or whatever) are freed even if the thread is canceled. ==
много думал, но ни к чему не пришел. Прошу помощи клуба.