i have 4 threads. in each thread, there is a For loop. each thread is filling data in an array using that loop. now i want to update a progress bar based on the work these 4 threads are doing. how to do it? i thot of putting a global variable but the problem in that is each thread works randomly and will update that variable randomly. so the progress bar will go back and forth.it wont be smooth.