You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2011/06/05 10:56:54 UTC

svn commit: r1132192 - in /incubator/mesos/trunk/third_party/libprocess: process.cpp process.hpp

Author: benh
Date: Sun Jun  5 08:56:53 2011
New Revision: 1132192

URL: http://svn.apache.org/viewvc?rev=1132192&view=rev
Log:
Made 'serve' take a timeout instead.

Modified:
    incubator/mesos/trunk/third_party/libprocess/process.cpp
    incubator/mesos/trunk/third_party/libprocess/process.hpp

Modified: incubator/mesos/trunk/third_party/libprocess/process.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/libprocess/process.cpp?rev=1132192&r1=1132191&r2=1132192&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/libprocess/process.cpp (original)
+++ incubator/mesos/trunk/third_party/libprocess/process.cpp Sun Jun  5 08:56:53 2011
@@ -2712,30 +2712,29 @@ MSGID Process::receive(double secs)
 }
 
 
-MSGID Process::serve(bool forever)
+MSGID Process::serve(double secs)
 {
-  do {
-    switch (receive()) {
-      case PROCESS_DISPATCH: {
-        void *pointer = (char *) current + sizeof(struct msg);
-        std::tr1::function<void (void)> *delegator =
-          *reinterpret_cast<std::tr1::function<void (void)> **>(pointer);
-        (*delegator)();
-        delete delegator;
-        break;
-      }
+  switch (receive(secs)) {
+    case PROCESS_DISPATCH: {
+      void *pointer = (char *) current + sizeof(struct msg);
+      std::tr1::function<void (void)> *delegator =
+        *reinterpret_cast<std::tr1::function<void (void)> **>(pointer);
+      (*delegator)();
+      delete delegator;
+      break;
+    }
 
-      default: {
-        return msgid();
-      }
+    default: {
+      return msgid();
     }
-  } while (forever);
-};
+  }
+}
 
 
 void Process::operator () ()
 {
-  serve();
+  while (true)
+    serve();
 }
 
 

Modified: incubator/mesos/trunk/third_party/libprocess/process.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/libprocess/process.hpp?rev=1132192&r1=1132191&r2=1132192&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/libprocess/process.hpp (original)
+++ incubator/mesos/trunk/third_party/libprocess/process.hpp Sun Jun  5 08:56:53 2011
@@ -160,7 +160,7 @@ protected:
   virtual MSGID receive(double secs = 0);
 
   /*  Processes dispatch messages. */
-  virtual MSGID serve(bool forever = true);
+  virtual MSGID serve(double secs = 0);
 
   /* Blocks at least specified seconds (may block longer). */
   virtual void pause(double secs);