There are a total of A, B, and C threads, and A and B are threads that call back and receive data signals.
I want to implement a thread running and stop immediately based on receiving signal data.
- If data is number 1, run C thread
- If the data is number 2, immediately abort the C thread. (C thread 1 loop takes about 1 minute)
I want to implement a thread that can repeatedly perform steps 1 and 2 above. (signal variable receives button signal through mobile phone)
What should I do?
c = threading.Thread(target=test.main)
def call_back(signal):
if signal == 1:
c.start() # start
elif signal == 2:
c.join() # stop