Clears the queue. Note that calling #wait*( immediately after clear can
    still block when tasks are currently being processed since this method can
    only clear queued items.

def clear(self):
    """
    Clears the queue. Note that calling #wait*( immediately after clear can
    still block when tasks are currently being processed since this method can
    only clear queued items.
    """

    self._tasks -= len(self._deque)
    self._deque.clear()
    notify_all(self)