title: Can't pickle <type 'thread.lock'> when using python multiprocess.pool.map_async()
body: <p>I'm trying to use <code>map_async</code> on a class method and I get this error:
  <code>PicklingError: Can't pickle &lt;type 'thread.lock'&gt;: attribute lookup thread.lock failed</code>
  my code :</p>
  
  <pre><code>def _pickle_method(method):
      func_name = method.im_func.__name__
      obj = method.im_self
      cls = method.im_class
      cls_name = ''
      if func_name.startswith('__') and not func_name.endswith('__'):
          cls_name = cls.__name__.lstrip('_')
      if cls_name:
          func_name = '_' + cls_name + func_name
      return _unpickle_method, (func_name, obj, cls)
  
  def _unpickle_method(func_name, obj, cls):
      for cls in cls.mro():
          try:
              func = cls.__dict__[func_name]
          except KeyError:
              pass
          else:
              break
      return func.__get__(obj, cls)
  
  copy_reg.pickle(types.MethodType, _pickle_method, _unpickle_method)
  
  class MyClass(object):
      def Submit(self,cmd):
          subprocess.call(cmd, shell=True)
  
      def RunTest(self):
          cmds = []
          for i in range(50):
              cmd = CreateCmd(self)
              cmds.append(cmd)
          self.pool.map_async(self.Submit, cmds) 
  
      def Main(self):
          self.pool = mp.pool
          while True:
             RunTest(self)
  
  if __name__ == "__main__":
      MyClass()
  </code></pre>
  
  <p>when <code>Submit</code> is outside the class it works but like this I get the error.
  also, <code>MyClass</code> has some more methods and attributes that I didn't wrote, one of them is a logger, could this be the problem?</p>