title: deadLock using multiprocessing.Pipe
body: <p><strong>I'm trying to create a process to communicate with a thread.</strong></p>
  
  <p>I'm trying to send data to the process, and the process need to do something with the data, and return the answer.</p>
  
  <p>I don't understand what is the problem.</p>
  
  <pre><code>class Worker(threading.Thread):
      """Thread executing tasks from a given tasks queue"""
      def __init__(self, tasks):
          threading.Thread.__init__(self)
          self.daemon = True
          self.name = "RemoteWorker_%s" % id(self)
          # Queue shared with all threads
          self.tasks = tasks
          # Pipe's shared with the current thread(self) and the process
          self.procInput, self.threadOutput = Pipe(duplex=True)
          self.threadInput, self.procOutput = Pipe(duplex=True)
  
          # Create Process for running the Tasks.
          self.proc = Process(target=execute,
                              args=(self.procOutput,
                                    self.procInput))
          self.proc.start()
          self.start()
  
      def run(self):
          while True:
              (func, args, kargs), _ = self.tasks.get()
              func(self, *args, **kargs) # parent_proc_runner
  
      def put(self, arg):
          self.threadOutput.send(arg)
  
      def get(self):
          return self.threadInput.recv()
  
      def stop(self):
          self.tasks.put((StopIteration, None, None))  # stop thread
          ProcessTask.KillProcess(self.proc.pid)  # kill process
  
  def execute(q):
      procInput, procOutput = q
      rc = None
      exception = None
  
      while True:
          args, kwargs = procInput.recv()
          rc, exception = runner(*args, **kwargs)
          procOutput.send((rc, exception))
  
  def parent_proc_runner(worker, *args, **kwargs):
      rc = None
      exception = None
      worker.put((args, kwargs))
      rc, exception = worker.get() # here i'm in a deadlock
      return rc, exception
  </code></pre>
  
  <p>The same code i did it with Queue, and it worked, but i had performance issues.
  please if someone can help me, i will appreciate it.</p>
  
  <p>Thanks.</p>