Using fork join_none to span threads in a for loop in parallel, which is executed in forever loop

In reply to VarshaAnand2402:

Your code is creating infinite number of threads… and each thread is trying to run
monitor_signal.

If you look at the logic, the for_loop runs MAX_EX_PARAM times and creates monitor_signal threads. After this it exits the for_loop, jumps into the forever_loop and reenters for_loop
This creates another MAX_EX_PARAM threads all running monitor_signal.