title: read a variable while multithreading
body: <p>I get two streams of data from an API, so there are 3 threads, main one, stream1 and stream2. Stream1 and Stream2 need to process this data and once they're done they store them on main_value1 and main_value2.</p>
  
  <p>From main thread I need to read the last value at any given time (so if I need this value and it is still processing then I get the last processed/stored one), what would be the optimal way? from the code example here I need help in coding functions get_main_value1() and, of course, get_main_value2()</p>
  
  <pre><code>def stream1():
      while True:
           main_value1 = process()
  def stream2():
      while True:
          main_value2 = process2()
  def get_main_value1(): ?
  def get main_value2(): ?
  def main():
      threading.Thread(function=stream1,).start()
      threading.Thread(function=stream2).start()
      while True:
          time.sleep(random.randint(0,10))
          A = get_main_value1()
          B = get_main_value2()
  </code></pre>