python thread queue


q1 = queue.Queue () # FIFO
q2 = queue.LifoQueue () # LIFO
q3 = queue.PriorityQueue () # priority queue (dequeue from small to large)
initialization parameters:
MAXSIZE: the maximum capacity of the queue
Examples of commonly used function:
GET (): the column
put (): enqueues
get_nowait (): when no element is not blocked, but directly given equivalent GET (Block = False)
put_nowait (): when the queue is full had not blocked, but direct given equivalent PET (Item, Block = False)
empty (): whether the queue is empty
qsize (): returns the queue size
(after running get ()) task_done () sends a signal to the task has been completed queue
join () when the queue empty (non-initial: and received task_done () signal and then performs subsequent task)

Guess you like

Origin www.cnblogs.com/lides/p/11184262.html
Recommended