Click here to Skip to main content
15,917,455 members
Home / Discussions / C#
   

C#

 
GeneralRe: OT Pin
fracalifa2-Jul-05 7:04
fracalifa2-Jul-05 7:04 
GeneralRe: OT Pin
DavidNohejl2-Jul-05 7:17
DavidNohejl2-Jul-05 7:17 
GeneralRe: OT Pin
Colin Angus Mackay3-Jul-05 1:36
Colin Angus Mackay3-Jul-05 1:36 
Questionerror in bool condition ? Pin
fracalifa1-Jul-05 23:45
fracalifa1-Jul-05 23:45 
AnswerRe: error in bool condition ? Pin
Dario Solera1-Jul-05 23:52
Dario Solera1-Jul-05 23:52 
AnswerRe: error in bool condition ? Pin
Robert Rohde2-Jul-05 0:04
Robert Rohde2-Jul-05 0:04 
GeneralRe: error in bool condition ? Pin
fracalifa2-Jul-05 0:29
fracalifa2-Jul-05 0:29 
AnswerRe: error in bool condition ? Pin
User 66582-Jul-05 1:03
User 66582-Jul-05 1:03 
GeneralRe: error in bool condition ? Pin
fracalifa2-Jul-05 1:10
fracalifa2-Jul-05 1:10 
GeneralRe: error in bool condition ? Pin
User 66582-Jul-05 6:21
User 66582-Jul-05 6:21 
GeneralRe: error in bool condition ? Pin
fracalifa2-Jul-05 6:45
fracalifa2-Jul-05 6:45 
GeneralRe: error in bool condition ? Pin
User 66582-Jul-05 7:52
User 66582-Jul-05 7:52 
GeneralRe: error in bool condition ? Pin
Niklas Ulvinge3-Jul-05 2:53
Niklas Ulvinge3-Jul-05 2:53 
QuestionHow to find relation between user , process created by him and his session Pin
rajee.nedunchezian1-Jul-05 23:37
rajee.nedunchezian1-Jul-05 23:37 
AnswerRe: How to find relation between user , process created by him and his session Pin
Dario Solera1-Jul-05 23:48
Dario Solera1-Jul-05 23:48 
Generalpopulating datagrid with array of objects Pin
deep71-Jul-05 23:34
deep71-Jul-05 23:34 
GeneralChanging Regional Language of a TextBox Pin
Ali Beirami1-Jul-05 23:01
Ali Beirami1-Jul-05 23:01 
GeneralSend a click to an application Pin
Dario Solera1-Jul-05 21:15
Dario Solera1-Jul-05 21:15 
GeneralAdding Help in a software Pin
asmyan1-Jul-05 21:06
asmyan1-Jul-05 21:06 
GeneralRe: Adding Help in a software Pin
Ashok Dhamija1-Jul-05 21:10
Ashok Dhamija1-Jul-05 21:10 
GeneralRe: Adding Help in a software Pin
Dario Solera1-Jul-05 23:55
Dario Solera1-Jul-05 23:55 
GeneralThreads and System.Timers.Timer - Problems Pin
stan281-Jul-05 20:41
stan281-Jul-05 20:41 
Have you guys ever realised that when you have a component class that has a timer, and when your Thread calling the method finishes off, the Timer events still gets fired.. Why is this so.. Look at the following code as an illustration.


public class WithTimer : System.ComponentModel.Component
{
 private System.Timers.Timer timer1;
 public WithTimer(){}
 public void StartTimer()
 {
  int i=0;
  while(true)//For Demo Purpose - Otherwise should use ManualResetEvent
  {
   if(i==0)
    timer1.Start();
   i++;
  }
 }
}

public class MainApp
{
 public static void Main() 
 {
   WithTimer m_Timer = new WithTimer();
   Thread _Thread1 = new Thread{new ThreadStart(m_Timer.StartTimer)};
   _Thread1.background = true;
   _Thread1.Start();
   _Thread1.Abort();
 }
}


Now as you can see in the code, after _Thread1.Abort(), i realise that m_timer events still gets called, even after the Thread has exited gracefully.
This ONLY happens with the Timer events. Anyone know why this is happening ?
Any solutions to this ?


Stanley
GeneralRe: Threads and System.Timers.Timer - Problems Pin
S. Senthil Kumar1-Jul-05 21:22
S. Senthil Kumar1-Jul-05 21:22 
GeneralRe: Threads and System.Timers.Timer - Problems Pin
stan283-Jul-05 7:37
stan283-Jul-05 7:37 
GeneralRe: Threads and System.Timers.Timer - Problems Pin
leppie2-Jul-05 6:47
leppie2-Jul-05 6:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.