Prev: Interrupting a native thread
Next: Clean Cannot run my application outside VS without previously doing a "clean" before rebuild
From: Tony Johansson on 5 May 2010 05:18 Hi! I'm debugging a windows service and it works perfect but there is one thing that I wonder about and that is what happen to all those calls to the t_Elapsed method when I keep Visual Studio executing on the same row without stepping through the t_Elapsed method code. I mean the service control manager will keep calling the t_Elapsed method every 10 seconds. When I test this nothing unusual happen accept that when I step through the t_Elapsed method another call is pending to the t_Elapsed method. So there will be many pending calles buffered to the t_Elapsed method if I keep Visual Studio on the same row without stepping through the code. So my question is if anyone know how the implementatin is used with the buffering of calls to the t_Elapsed method? For example is there some kind of limit of how many pending calls there could exist to the t_Elapsed method. As I mention when I test this I didn't discoved any kind of error so there might be some kind of ringbuffer overwriting old pending calls with new pending calls. void t_Elapsed(object sender, ElapsedEventArgs e) { try { // Send the HTTP request string url = "http://www.microsoft.com"; HttpWebRequest g = (HttpWebRequest)WebRequest.Create(url); HttpWebResponse r = (HttpWebResponse)g.GetResponse(); // Log the response to a text file string path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "log.txt"; TextWriter tw = new StreamWriter(path, true); tw.WriteLine(DateTime.Now.ToString() + " for " + url + ": " + r.StatusCode.ToString()); tw.Close(); // Close the HTTP response r.Close(); } catch (Exception ex) { System.Diagnostics.EventLog.WriteEntry("Application", "Exception: " + ex.Message.ToString()); } //Tony |