]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Loop until the specified number of bytes has been written, since write
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 1 Oct 2002 19:10:30 +0000 (19:10 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 1 Oct 2002 19:10:30 +0000 (19:10 +0000)
may return early.

git-svn-id: https://svn.dealii.org/trunk@6586 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/source/sparse_direct.cc

index 932311b6513b15b4817321ba3146cd9aaf0d0738..26cbfaaa82fd00f4c996c03b080009ee1abfa804 100644 (file)
@@ -360,18 +360,22 @@ struct SparseDirectMA27::DetachedModeData
     template <typename T>
     void put (const T *t, const size_t N, const char *debug_info) const
       {
-                                         // repeat writing until syscall is
-                                         // not interrupted
-        int ret;
-        do
-          ret = write (server_client_pipe[1],
-                       reinterpret_cast<const char *> (t),
-                       sizeof(T) * N);
-        while ((ret<0) && (errno==EINTR));
-        if (ret < 0)
-          die ("error on client side in 'put'", ret, errno);
-        if (ret < static_cast<signed int>(sizeof(T)*N))
-          die ("not everything was written", ret, sizeof(T)*N);
+        unsigned int count = 0;
+        while (count < sizeof(T)*N)
+          {
+                                             // repeat writing until syscall is
+                                             // not interrupted
+            int ret;
+            do
+              ret = write (server_client_pipe[1],
+                           reinterpret_cast<const char *> (t),
+                           sizeof(T) * N);
+            while ((ret<0) && (errno==EINTR));
+            if (ret < 0)
+              die ("error on client side in 'put'", ret, errno);
+
+            count += ret;
+          };
         
         fflush (NULL);
         CommunicationsLog::
@@ -394,8 +398,8 @@ struct SparseDirectMA27::DetachedModeData
             
             if (ret < 0)
               die ("error on client side in 'get'", ret, errno);
-            else
-              count += ret;
+
+            count += ret;
           };
         
         CommunicationsLog::

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.