public System.Threading.Timer[] time_array = new System.Threading.Timer[5000];for(int i=0;i<100;i++)
{
实例1; time_array[i] = new System.Threading.Timer(new System.Threading.TimerCallback(thread_begin), 实例1, 0, 3600000);
}public void thread_begin(object o)
{
....
}线程定时器有如上操作,请教线程安全如何实现?线程安全线程
{
实例1; time_array[i] = new System.Threading.Timer(new System.Threading.TimerCallback(thread_begin), 实例1, 0, 3600000);
}public void thread_begin(object o)
{
....
}线程定时器有如上操作,请教线程安全如何实现?线程安全线程
解决方案 »
- C#代码是什么意思
- 请教大家c#代码翻译到c++代码的问题
- 尝试读取或写入受保护的内存。这通常指示其他内存已损坏。
- 关于winform里panel可见性的奇怪问题
- VS2005中使用///注释
- WINDOWS2003的网站下的文件夹的只读属性改掉还是会变成只读属性,请问如何解决?这样我存照片没有权限...
- 如何给线程传参
- 向大家请教 有关判断串口接收数据 以及使用AT COMMAND 控制手机收发短信的问题。
- 我的C盘太小了,v7.0装不上,pqmagic不支持win2000!听说配置好VC6.0,其能运行C#??
- 通过引用wsdl文件,调用webservice出错:请求被取消
- 用什么算法能消除,不同的阳光对同一张照片对RGB的影响,使一张照片能在不同的阳光的下的像素值一样?
- string.IndexOf怎么效率这么低,程序从vc的CString::Find移植过来几乎慢的不能用了
System.Threading.Mutex mutex; mutex.WaitOne();
//公共区
mutex.ReleaseMutex();
public void thread_begin(object o)
{
lock(syncLock)
{
// 操作
}
}
另外实例1的声明不应该在for循环中
如果使用System.Windows.Forms.Timer的话 不需要考虑线程安全