multithreading - c# - How to stop a timer Immediately -
i have system.timers.timer 100 interval. question if set enable = false in timer, current working process in timer method stop immediately? or after method finished.
private void watchtags(object obj, elapsedeventargs handler) { for(int i=0 ; i<10000;i++){ // works } } private void stop_button(){ watcher.enabled = false; }
is loop stop or after finish?
doing timer.enabled = false
stop timer. same timer.stop();
timer.enabled = false
= system.threading.timer
or system.timers.timer
timer.stop();
=system.windows.forms.timer
Comments
Post a Comment