title: Run an infinite process that checks multiprocessing queues for processing
body: <p>The program has three parts: Add data to queues, Process data in Queues and Check if queue's empty. Each except Add(), all parts having their own process. The program should function like this, When we start it,<br>
  <li>It should keep checking queues, if anything in it run the function, if not keep running. </li><br>
  <li>At the same time, an asynchronous data can be added to the queue and it should run the job like stated previously</li>
  Only one thing can be processed from the queue at a time.</p>
  
  <p>I am using windows, and I keep getting</p>
  
  <pre><code>TypeError: can't pickle _thread.lock objects
  </code></pre>
  
  <p>Here is the code</p>
  
  <pre><code>from multiprocessing import Queue,Process
  from time import sleep
  import threading
  from multiprocessing.pool import ThreadPool
  from multiprocessing import dummy as multithreading
  import concurrent.futures
  
  # import queue
  class A(object):
      def __init__(self, *args, **kwargs):
          self.Q = Queue()
  
  #Add data to queue: should be accessable all time
      def Add(self, i):
          # q = Queue()
          self.Q.put(threading.Thread(target=self.printAns(i)))
  
  #Processes the data: runs only upon call
      def printAns(self,name):
          print("Name to print is: ",name)
          return 'completed'
  
  #This function call printANS as a process
      def jobRun(self):
          # job = self.Q.get()
          # ans = Queue()
          jobThread = self.Q.get()
          async_result = jRPool.apply_async(jobThread)
          print(async_result.get())
  
  #Checks if the queue has anything: checker functions needs to run constantly
      def checkQueue(self):
          while True:
              if self.Q.empty():
                  pass
              else:
                  return True
  
  #should initiate call to checker upon success calls jobRun() as a process and go back to checking
      def run(self):
          with concurrent.futures.ProcessPoolExecutor() as executor:
              checkfunc = executor.map(self.checkQueue)
              while True:
                  if checkfunc:
                      sleep(1)
                      executor.map(self.jobRun)
                      self.Q.close()  
  
  
  
  
  if __name__ == '__main__':
      a = A()
      a.Add("test1")
      a.Add("test2")
      a.run()
      # a.Add("this")
      while True:
          data = input("Enter a string: ")
          a.Add(data)
  </code></pre>
  
  <p>Any Kind of help is deeply appreciated. My hunch is something has to do with locks or semaphores.</p>