title: Multiprocessing, Python3, Windows: TypeError: can't pickle _thread.lock objects
body: <p>On a Windows 10 system running Python 3.6, when trying to use <code>multiprocessing.Process</code> to create a new <code>rq</code> worker,</p>
  
  <pre><code>multiprocessing.Process(target=Worker(qs).work, kwargs={'burst': True}).start()     
  </code></pre>
  
  <p>we encounter the error</p>
  
  <blockquote>
    <p>TypeError: can't pickle _thread.lock objects</p>
  </blockquote>
  
  <p>and </p>
  
  <blockquote>
    <p>OSError: [WinError 87] The parameter is incorrect</p>
  </blockquote>
  
  <p><code>rq.SimpleWorker</code> was used instead of <code>rq.Worker</code> because Windows does not support the <code>fork</code> function used by <code>rq.Worker</code>.</p>
  
  <p><strong>Question:</strong> What is causing this error? How can we solve it?</p>
  
  <pre><code>from rq import SimpleWorker, Connection
  
  def needMoreWorkers():
      return True
  
  if __name__ == '__main__':
      qs = sys.argv[1:] or ['default']
      with Connection(connection=my_redis_conn):
          if needMoreWorkers():
              multiprocessing.Process(target=SimpleWorker(qs).work, kwargs={'burst': True}).start()     
  </code></pre>
  
  <p><strong>Error Traceback</strong></p>
  
  <pre><code>Traceback (most recent call last):
  File "WorkerFactory.py", line 53, in &lt;module&gt;
      main(qs)
  File "WorkerFactory.py", line 45, in main
      multiprocessing.Process(target=SimpleWorker(qs)).start()
  File "C:\Users\x\AppData\Local\Continuum\anaconda3\envs\test\lib\multiprocessing\process.py", line 105, in start
      self._popen = self._Popen(self)
  File "C:\Users\x\AppData\Local\Continuum\anaconda3\envs\test\lib\multiprocessing\context.py", line 223, in _Popen
      return _default_context.get_context().Process._Popen(process_obj)
  File "C:\Users\x\AppData\Local\Continuum\anaconda3\envs\test\lib\multiprocessing\context.py", line 322, in _Popen
      return Popen(process_obj)
  File "C:\Users\x\AppData\Local\Continuum\anaconda3\envs\test\lib\multiprocessing\popen_spawn_win32.py", line 65, in __init__
      reduction.dump(process_obj, to_child)
  File "C:\Users\x\AppData\Local\Continuum\anaconda3\envs\test\lib\multiprocessing\reduction.py", line 60, in dump
      ForkingPickler(file, protocol).dump(obj)
  TypeError: can't pickle _thread.lock objects
  
  (test) C:\Code\test\source&gt;Traceback (most recent call last):
  File "&lt;string&gt;", line 1, in &lt;module&gt;
  File "C:\Users\x\AppData\Local\Continuum\anaconda3\envs\test\lib\multiprocessing\spawn.py", line 99, in spawn_main
      new_handle = reduction.steal_handle(parent_pid, pipe_handle)
  File "C:\Users\x\AppData\Local\Continuum\anaconda3\envs\test\lib\multiprocessing\reduction.py", line 82, in steal_handle
      _winapi.PROCESS_DUP_HANDLE, False, source_pid)
  OSError: [WinError 87] The parameter is incorrect   
  </code></pre>