I am not sure how multithread works in Python so that's why I am asking this question. I'd appreciate if there are examples of codes about this problem. The problem is as follows:
Say I have 4 arrays, X1, X2, X3 and X4. X1 through X4 are data live-streamed to python from an outside source. They get updated for every second.
Then I have 4 threads:
Th1 handling array X1, Th2 handling X2,... and Th4 handling X4 respectively.
What thread I does is the following:
Whenever a special pattern appears in Xi, return a signal back to the outside source. This thread i only stops when the live stream of array Xi is terminated.
Yes, multithreading and multiprocessing allow you to perform tasks in parallel. You could use them to loop through your 4 arrays in parallel. However, you would need a different library to transmit the data you are using.