本文介绍了进度条和多线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有4个线程.在每个线程中,都有一个For循环.每个线程都使用该循环将数据填充到数组中.现在我想根据这四个线程正在做的工作来更新进度条.怎么做?我想放置一个全局变量,但是问题在于每个线程都是随机工作的,并且会随机更新该变量.所以进度条会来回移动.它不会很顺畅.

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.

推荐答案


这篇关于进度条和多线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 06:25
查看更多