multithreading - Python: how to use pickle to dump Queue objects? -


the problem directly using pickle dump queue raise exception. have read similar post not got answer yet: pickle queue objects in python

i can't replace queue collections.deque because i'm running multithreading program, in queue used synchronization.

so how can this?

if need save queue remaining content the (one , one) master thread after consumer , producer threads have terminated, have dump queue plain of list -- , use pickle persist list.

def qdumper(q):     try:         yield q.get(false)     except queue.empty:         pass  remaining = [item item in qdumper(my_queue)] pickle.dump(remaining, ....) 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -