From: wolf Date: Fri, 27 Sep 2002 15:44:45 +0000 (+0000) Subject: check for EINTR upon read and write. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2425782e645a6d5960b806c3178e45f589bc879;p=dealii-svn.git check for EINTR upon read and write. git-svn-id: https://svn.dealii.org/trunk@6541 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/contrib/hsl/source/detached_ma27.cc b/deal.II/contrib/hsl/source/detached_ma27.cc index f4672266e8..bfe48ade6e 100644 --- a/deal.II/contrib/hsl/source/detached_ma27.cc +++ b/deal.II/contrib/hsl/source/detached_ma27.cc @@ -22,9 +22,16 @@ template void put (const T *t, const size_t N, const char */*debug_info*/) { - write (1, - reinterpret_cast (t), - sizeof(T) * N); + try_write: + int ret = write (1, + reinterpret_cast (t), + sizeof(T) * N); + // if write call was + // interrupted, just + // retry + if ((ret<0) && (errno==EINTR)) + goto try_write; + fflush (NULL); }; @@ -35,9 +42,16 @@ void get (T *t, const size_t N, const char */*debug_info*/) unsigned int count = 0; while (count < sizeof(T)*N) { + try_read: int ret = read (0, reinterpret_cast (t) + count, sizeof(T) * N - count); + // if read call was + // interrupted, just + // retry + if ((ret<0) && (errno==EINTR)) + goto try_read; + if (ret < 0) { std::cerr << "------ error " << ret << " on client side!"