问题描述
Hai,
我在VS2012中使用控制台应用程序。
我想从MS Access DataBase更新员工信息(有超过70000条记录。 )。
因为服务器无法同时加载所有记录,我需要让我的进程休眠一分钟,它必须从它已经停止的记录开始。 />
for exmaple,
我使用的是for循环,
Hai,
I am using a console application in VS2012.
I want to update the employee information from the MS Access DataBase(More than 70000 records are there.).
since the server is not able to load all the records at the same time, I need to make my process sleep for one minute and it has to start from the record it has stopped.
for exmaple,
I am using a for loop,
for(int i=0;;i++)
{
if(i<200)
{
while(dbReader.read())
{
//Logic goes here
// it gets the employee details one by one.
}
}
else//when it has reached the limit
{
system.Threading.Thread.sleep(60000)
}
}
现在在else部分,线程休眠一分钟,但我不知道如何从线程已经睡眠的记录中再次启动进程。
即
eg),循环进入第199个记录并睡眠一分钟。
然后它应该从第200个记录开始并在第399个记录之后休眠并继续......
先谢谢!!!
Now in the else part the thread sleeps for one minute but I don't know how to start the process again from the record that the thread has slept.
That is,
eg),the loop goes till 199th record and sleeps for one minute.
then it should start from the 200th record and sleeps after 399th record and goes on...
Thanks in Advance!!!
推荐答案
这篇关于如何让进程睡眠并重新启动它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!