class_docstr: A thread-safe queue implementation for multiple producers and consumers.
  
  Provide `release()` to exit producer threads cooperatively for resource release.
code: def __init__(self, queue_size: int):
      # The queue shared across multiple producer threads.
      self._queue = deque()
      # The boolean varilable to indicate whether producer threads should exit.
      self._threads_exit = False
      # The semaphore for producer threads to put item into queue.
      self._producer_semaphore = threading.Semaphore(queue_size)
      # The semaphore for consumer threads to get item from queue.
      self._consumer_semaphore = threading.Semaphore(0)
      # The mutex lock to guard access of `self._queue` and `self._threads_exit`.
      self._mutex = threading.Lock()
  
imports: import importlib
  import logging
  import os
  import pathlib
  import random
  import sys
  import threading
  import time
  import urllib.parse
  from collections import deque
  from types import ModuleType
  from typing import TYPE_CHECKING, Any, Callable, Dict, Iterable, Iterator, List, Optional, Tuple, TypeVar, Union
  import numpy
  import ray
  from ray._private.utils import _get_pyarrow_version
  from ray.data._internal.arrow_ops.transform_pyarrow import unify_schemas
  from ray.data.context import WARN_PREFIX, DataContext
label_desc: Use image node_id 1 to create a new Queue object  with example: obj = Queue(queue_size)