Split signalling tasks to end and waiting for them to end into separate for loops.