Jan-Philip Gehrcke  committed 1c26db4

Print warning upon redundant process start(), make _GProcess.__repr__ not call mp poll.

  • Participants
  • Parent commits ae8692f
  • Branches default

Comments (0)

Files changed (1)

File gipc/

     Process creation is based on ``multiprocessing.Process()``. When working
     with gevent, it is highly recommended to start child processes in no other
-    way than via via :func:`start_process`. It takes care of most of the magic
+    way than via via :func:`start_process`. It triggers most of the magic
     behind ``gipc``.
     if not isinstance(args, tuple):
     if daemon is not None:
         p.daemon = daemon
+    p.start = lambda *a, **b: sys.stderr.write(
+        "gipc WARNING: Redundant call to %s.start()\n" % p)
     if WINDOWS:
         for h in childhandles:
         is not recommended to call it in the context of this module.
         ``gipc`` prevents ``multiprocessing`` from calling ``os.waitpid()`` by
         monkey-patching ``multiprocessing.forking.Popen.poll`` to always return
-        ``None``.
+        ``None``. Calling :class:`gipc._GProcess`.join() is not required for
+        cleaning up after zombies. It just waits until the process has
+        terminated.
     # Remarks regarding child process monitoring on Unix:
         def exitcode(self):
             return self._popen.returncode
+        def __repr__(self):
+            """Based on original __repr__ from Python 2.7's mp package.
+            """
+            status = 'started'
+            if self.exitcode is not None:
+                status = self.exitcode
+            return '<%s(%s, %s%s)>' % (type(self).__name__, self._name,
+                status, self._daemonic and ' daemon' or '')
     def join(self, timeout=None):
         Wait cooperatively until child process terminates or timeout occurs.