title: python Infinite Loop append in multiprocessing.manger list
body: <p><strong>Why this code isnt working:</strong></p>
  
  <pre><code>from multiprocessing import Process, Manager
  import pcap, string, sys
  
  
  def f(a, p):
      try:
          while True:
              a.append(p.next())
      except KeyboardInterrupt:
          print 'stop'
  
  
  def g(a):
      # print a
      while True:
          print a[len(a)-1]
  
  
  if __name__ == '__main__':
      # num = Value('d', 0.0)
      manager = Manager()
      l = manager.list([])
      p = pcap.pcapObject()
      dev = sys.argv[1]
      p.open_live(dev, 65000, 0, 100)
      p.setfilter(string.join(sys.argv[2:], ' '), 0, 0)
  
      p = Process(target=f, args=(l, p))
      p.start()
      p.join()
  
      a = Process(target=g, args=(l,))
      a.start()
      a.join()
  
      # print l
      # print len(l)
  </code></pre>
  
  <p><strong>while below code is working fine:</strong></p>
  
  <pre><code>from multiprocessing import Process, Manager
  import pcap, string, sys
  
  
  def f(a, p):
      try:
          while len(a) &lt; 100:
              a.append(p.next())
      except KeyboardInterrupt:
          print 'stop'
  
  
  def g(a):
      # print a
      while True:
          print a[len(a)-1]
  
  
  if __name__ == '__main__':
      # num = Value('d', 0.0)
      manager = Manager()
      l = manager.list([])
      p = pcap.pcapObject()
      dev = sys.argv[1]
      p.open_live(dev, 65000, 0, 100)
      p.setfilter(string.join(sys.argv[2:], ' '), 0, 0)
  
      p = Process(target=f, args=(l, p))
      p.start()
      p.join()
  
      a = Process(target=g, args=(l,))
      a.start()
      a.join()
  
      # print l
      # print len(l)
  </code></pre>
  
  <p>Other Question:</p>
  
  <ul>
  <li>Is this is a best and fastest/optimized way way to create shared
  memory between different processes? </li>
  <li>Is multiprocessing.manager class for finite size  data structure. if
  no what am i doing wrong?</li>
  </ul>
  
  <p>any help/hint would be appreciated. Thanx in advance.</p>