title: How to pause multiprocessing Pool from execution
body: <p>While using:</p>
  
  <pre><code>def myFunction(arg):
      for i in range(10000):
          pass
  
  from multiprocessing import Pool
  pool = Pool(processes=3)
  pool.map_async( myFunction, ['first','second','third'] )
  </code></pre>
  
  <p>I want the user to be able to pause an execution of the multiprocessing's Pool at any given time after the Pool was started. Then I would like the user to be able to unpause (to continue) with the rest of the items in a Pool. How to achieve it?</p>
  
  <h1>EDIT:</h1>
  
  <p>Here is the working implementation of suggestions posted by Blckknght. Thanks Blckknght!</p>
  
  <pre><code>import multiprocessing
  from PyQt4 import QtGui, QtCore
  
  
  def setup(event):
      global unpaused
      unpaused = event
  
  def myFunction( arg=None):
      unpaused.wait()
      print "Task started...", arg
      for i in range(15000000):
          pass
      print '...task completed.', arg
  
  
  class MyApp(object):
  
      def __init__(self):
          super(MyApp, self).__init__()
  
          app = QtGui.QApplication(sys.argv)
          self.mainWidget = QtGui.QWidget()
          self.mainLayout = QtGui.QVBoxLayout()
          self.mainWidget.setLayout(self.mainLayout)
  
          self.groupbox = QtGui.QGroupBox()
          self.layout = QtGui.QVBoxLayout()
          self.groupbox.setLayout(self.layout)
  
          self.pauseButton = QtGui.QPushButton('Pause')
          self.pauseButton.clicked.connect(self.pauseButtonClicked)      
          self.layout.addWidget(self.pauseButton) 
  
          self.okButton = QtGui.QPushButton('Start Pool')
          self.okButton.clicked.connect(self.startPool) 
          self.layout.addWidget(self.okButton)
          self.layout.addWidget(self.pauseButton)      
  
          self.mainLayout.addWidget(self.groupbox)
          self.mainWidget.show()
          sys.exit(app.exec_())
  
  
      def startPool(self):
          self.event = multiprocessing.Event()
          self.pool=multiprocessing.Pool(1, setup, (self.event,))
          self.result=self.pool.map_async(myFunction, [1,2,3,4,5,6,7,8,9,10])
          self.event.set()
          # self.result.wait()       
  
      def pauseJob(self):
          self.event.clear()
  
      def continueJob(self):
          self.event.set()
  
      def pauseButtonClicked(self):
          if self.pauseButton.text()=='Pause':
              print '\n\t\t ...pausing job...','\n'
              self.pauseButton.setText('Resume')
              self.pauseJob()
          else:
              print '\n\t\t ...resuming job...','\n'
              self.pauseButton.setText('Pause')            
              self.continueJob()
  
  if __name__ == '__main__':
      MyApp()
  </code></pre>