I have more of a conceptual question. Assume one program running two threads. Both threads are running loops all the time. One thread is responsible for streaming data and the other thread is responsible for receiving the file that the first thread has to stream. So the file transfer thread is loops to receive the data which it writes to a file and the streaming thread reads that data from that file as it needs it and streams it.
The problem I see here is how to avoid starvation when the file transfer is taking too much CPU cycles for it's own and thus making the streaming thread lag?
How would I be able to share the CPU effectively between those two threads knowing that the streamer streams data far slower than the file transfer receives it.
I thank you for your advice.