From: Julian Seward Date: Thu, 13 Jun 2002 17:29:53 +0000 (+0000) Subject: Make recvfrom() block only the calling thread, not the whole system X-Git-Tag: svn/VALGRIND_1_0_3~64 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3244f2ca6457e2b97c8ece6fa98db86d0325a4c9;p=thirdparty%2Fvalgrind.git Make recvfrom() block only the calling thread, not the whole system ( same trick as used for accept() ). git-svn-id: svn://svn.valgrind.org/valgrind/trunk@415 --- diff --git a/coregrind/arch/x86-linux/vg_libpthread.c b/coregrind/arch/x86-linux/vg_libpthread.c index 5a76219fec..6911474b86 100644 --- a/coregrind/arch/x86-linux/vg_libpthread.c +++ b/coregrind/arch/x86-linux/vg_libpthread.c @@ -1659,6 +1659,8 @@ __attribute__((weak)) int recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen) { + __my_pthread_testcancel(); + wait_for_fd_to_be_readable_or_erring(s); __my_pthread_testcancel(); return __libc_recvfrom(s, buf, len, flags, from, fromlen); } diff --git a/coregrind/vg_libpthread.c b/coregrind/vg_libpthread.c index 5a76219fec..6911474b86 100644 --- a/coregrind/vg_libpthread.c +++ b/coregrind/vg_libpthread.c @@ -1659,6 +1659,8 @@ __attribute__((weak)) int recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen) { + __my_pthread_testcancel(); + wait_for_fd_to_be_readable_or_erring(s); __my_pthread_testcancel(); return __libc_recvfrom(s, buf, len, flags, from, fromlen); } diff --git a/vg_libpthread.c b/vg_libpthread.c index 5a76219fec..6911474b86 100644 --- a/vg_libpthread.c +++ b/vg_libpthread.c @@ -1659,6 +1659,8 @@ __attribute__((weak)) int recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen) { + __my_pthread_testcancel(); + wait_for_fd_to_be_readable_or_erring(s); __my_pthread_testcancel(); return __libc_recvfrom(s, buf, len, flags, from, fromlen); }