Simple switching the flag from other thread that will stop loop in thread