class_docstr: Iterates over values from self.src in a separate thread but yielding them in the current thread. This allows values
  to be queued up asynchronously. The internal thread will continue running so long as the source has values or until
  the stop() method is called.
  
  One issue raised by using a thread in this way is that during the lifetime of the thread the source object is being
  iterated over, so if the thread hasn't finished another attempt to iterate over it will raise an exception or yield
  unexpected results. To ensure the thread releases the iteration and proper cleanup is done the stop() method must
  be called which will join with the thread.
  
  Args:
      src: Source data iterable
      buffer_size: Number of items to buffer from the source
      timeout: Time to wait for an item from the buffer, or to wait while the buffer is full when adding items
class_docstr_tok: ["Iterates","over","values","from","self.src","in","a","separate","thread","but","yielding","them","in","the","current","thread",".","This","allows","values","to","be","queued","up","asynchronously",".","The","internal","thread","will","continue","running","so","long","as","the","source","has","values","or","until","the","stop","(",")","method","is","called",".","One","issue","raised","by","using","a","thread","in","this","way","is","that","during","the","lifetime","of","the","thread","the","source","object","is","being","iterated","over",",","so","if","the","thread","has","n't","finished","another","attempt","to","iterate","over","it","will","raise","an","exception","or","yield","unexpected","results",".","To","ensure","the","thread","releases","the","iteration","and","proper","cleanup","is","done","the","stop","(",")","method","must","be","called","which","will","join","with","the","thread",".","Args",":","src",":","Source","data","iterable","buffer_size",":","Number","of","items","to","buffer","from","the","source","timeout",":","Time","to","wait","for","an","item","from","the","buffer",",","or","to","wait","while","the","buffer","is","full","when","adding","items"]
code: def stop(self):
      self.is_running = False  # signal the thread to exit
  
      if self.gen_thread is not None:
          self.gen_thread.join()
  
      self.gen_thread = None
  
imports: from __future__ import annotations
  from multiprocessing.context import SpawnContext
  from queue import Empty, Full, Queue
  from threading import Thread
  import torch
  from monai.data import DataLoader, Dataset
label_desc: Use image node_id 3 for calling the ThreadBuffer obj's underlying member method code with example usage: obj.stop() without return types