I've a application which runs with two threads. The main thread runs in one infinity-while-loop:
The second thread, which uses more than 50% of my CPU, must be able to stop and run again, which I asked already with this question on Stack Overflow.
The solution works perfectly, but as I already said, it uses >50% of the CPU. Here are the two loops of the solution:
How could I reduce the use of CPU while retaining the functionality?