]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
check for EINTR upon read and write.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 27 Sep 2002 15:44:45 +0000 (15:44 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 27 Sep 2002 15:44:45 +0000 (15:44 +0000)
git-svn-id: https://svn.dealii.org/trunk@6541 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/contrib/hsl/source/detached_ma27.cc

index f4672266e847cc55a10a743d006104559c1c1c60..bfe48ade6eb3e0c41a342d6ea8911e97d1b4ccae 100644 (file)
 template <typename T>
 void put (const T *t, const size_t N, const char */*debug_info*/)
 {
-  write (1,
-         reinterpret_cast<const char *> (t),
-         sizeof(T) * N);
+  try_write:
+  int ret = write (1,
+                   reinterpret_cast<const char *> (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<char *> (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!"

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.