lomg 发表于 2018-8-9 08:33:58

[python模块]队列queue

###queue的初始化函数###  
def __init__(self, maxsize=0):
  
      self.maxsize = maxsize
  
      self._init(maxsize)
  

  
      # mutex must be held whenever the queue is mutating.All methods
  
      # that acquire mutex must release it before returning.mutex
  
      # is shared between the three conditions, so acquiring and
  
      # releasing the conditions also acquires and releases mutex.
  

  
      self.mutex = _threading.Lock()
  

  
      # Notify not_empty whenever an item is added to the queue; a
  
      # thread waiting to get is notified then.
  

  
      self.not_empty = _threading.Condition(self.mutex)
  

  
      # Notify not_full whenever an item is removed from the queue;
  
      # a thread waiting to put is notified then.
  

  
      self.not_full = _threading.Condition(self.mutex)
  

  
      # Notify all_tasks_done whenever the number of unfinished tasks
  
      # drops to zero; thread waiting to join() is notified to resume
  

  
      self.all_tasks_done = _threading.Condition(self.mutex)
  
      self.unfinished_tasks = 0
页: [1]
查看完整版本: [python模块]队列queue