Skip to content

Instantly share code, notes, and snippets.

@metachris
Created February 11, 2011 03:52
Show Gist options
  • Save metachris/821889 to your computer and use it in GitHub Desktop.
Save metachris/821889 to your computer and use it in GitHub Desktop.
Adds example usage to help(multiprocessing.reduction)
#
# This patch for multiprocessing/reduction.py adds example usage to
# help(multiprocessing.reduction)
#
# Compatible with Python 2.6, 2.7 and 3.1.
#
6a7,20
> # Example usage:
> #
> # # Main process
> # from multiprocessing.reduction import reduce_handle
> # h = reduce_handle(client_socket.fileno())
> # pipe_to_worker.send(h)
> #
> # # Worker process
> # from multiprocessing.reduction import rebuild_handle
> # h = pipe.recv()
> # fd = rebuild_handle(h)
> # client_socket = socket.fromfd(fd, socket.AF_INET, socket.SOCK_STREAM)
> # client_socket.send("hello from the worker process\r\n")
> #
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment