Jan-Philip Gehrcke avatar Jan-Philip Gehrcke committed 1c26db4

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

Comments (0)

Files changed (1)

 
     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()
+    p.start = lambda *a, **b: sys.stderr.write(
+        "gipc WARNING: Redundant call to %s.start()\n" % p)
     if WINDOWS:
         for h in childhandles:
             h._post_createprocess_windows()
         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.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.