本文介绍了线程奇怪的行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有一个工作线程在运行,基本上它的操作是在无限循环中执行。 现在,当我暂停此线程时,CPU使用时间仍为 剩余100%。 我的问题可能是什么? 。 线程t1 =新线程(新的ThreadStart(myMethod)); Console.Writeline(按任意键开始); Console.Readline(); running = true; t1.Start(); Console.Writeline("按任意暂停); Console.Readline(); t1.Suspend(); Console.Readline(); ...这里的CPU使用率仍为100% myMethod() { while(运行) == true) { [code] } } 有人可以帮我吗 提前致谢Hi,I have a worker thread running, where basically its operation is toexecute in an infinite loop.Now, when I am suspending this thread, the CPU usage time is stillremaining 100%.What could my problem be.Thread t1 = new Thread(new ThreadStart(myMethod));Console.Writeline("Press any key to start");Console.Readline();running = true;t1.Start();Console.Writeline("Press any key to suspend");Console.Readline();t1.Suspend();Console.Readline();... here CPU usage still 100%myMethod(){while (running == true){[code]}}Can someone help me outThanks in Advance推荐答案 这篇关于线程奇怪的行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-23 03:35
查看更多