IAsyncResult result = command.BeginExecuteNonQuery();
while (!result.IsCompleted)
{
Console.WriteLine("Waiting ({0})", count++);
// Wait for 1/10 second, so the counter
// does not consume all available resources
// on the main thread.
System.Threading.Thread.Sleep(100);
}
Console.WriteLine("Command complete. Affected {0} rows.",
command.EndExecuteNonQuery(result));
这是MSDN上的 代码 是演示异步操作的 我想问下 System.Threading.Thread.Sleep(100); 这句的意思 是什么 从字面上 知道
怎么在MSDN上 找不到System.Threading??
系统当前的线程被 Sleep(100);
他也不知道是不是 IAsyncResult result = command.BeginExecuteNonQuery();
开启的这个线程啊 ?
要是 Sleep(100); 其他的线程怎么办呢 ?/
while (!result.IsCompleted)
{
Console.WriteLine("Waiting ({0})", count++);
// Wait for 1/10 second, so the counter
// does not consume all available resources
// on the main thread.
System.Threading.Thread.Sleep(100);
}
Console.WriteLine("Command complete. Affected {0} rows.",
command.EndExecuteNonQuery(result));
这是MSDN上的 代码 是演示异步操作的 我想问下 System.Threading.Thread.Sleep(100); 这句的意思 是什么 从字面上 知道
怎么在MSDN上 找不到System.Threading??
系统当前的线程被 Sleep(100);
他也不知道是不是 IAsyncResult result = command.BeginExecuteNonQuery();
开启的这个线程啊 ?
要是 Sleep(100); 其他的线程怎么办呢 ?/
将当前线程延迟100MS
Sleep(100)//线程休眠0.1秒
这样可以让你的线程得到短暂的休息,不置于崩溃
对了 是这个意思 程序在这个线程里在执行 将当前线程延迟100MS好的 明白了 System.Threading是命名空间 好的 我找到了 OK