I'm new enough to python programming and starting to dabble with concurrency for the first time, so please forgive any terms.
My programme starts two threads with each call a function "lightshow()" but rather than the programme stalling it's execution until both threads have completed it moves on to the next line in the code.
Is it possible to "pause" the progamme until both threads have completed?
Below is my code snippet:
from threading import Thread
# Handshake pulse on GPIO2 of 4 50ms highs
for pulse in range(5):
def lightshow(sequence, relay):
t_end = time.time() + 60*1
while time.time() < t_end:
# iterate over the dictionary's keys and values
for key, value in sequence.items():
setup() #send handshake to board to prime it.
t1 = threading.Thread(target = lightshow, args=(flickerRGB, relay1))
t2 = threading.Thread(target = lightshow, args=(flickerWhite, relay2))
#send handshake to Relay board to reset it
#send handshake to Relay board to reset it t2.join() #block until thread exits setup()
but since its just a hardcoded timeout why not just