[Mono-list] Bug in HttpWebRequest.cs and System.Timers namespace

gustavo ggb@tid.es
15 Oct 2002 00:28:26 +0200


There are 3 types of timers in .NET:
* System.Windows.Forms.Timer: UI timer. Using only one thread, events
received in the UI thread.
* System.Timers.Timer: worker ("server based") multithread timer. Events
received in a separate thread.
* System.Threading.Timer: lightweight worker ("server based")
multithread timer. Events received in a separate thread.

http://www.fawcette.com/vsm/2002_11/online/hottips/falossi/default_pf.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbconServerBasedTimers.asp

I'm trying to implement System.Timers namespace in System.dll assembly.

I think the simplest solution is to spawn a secondary thread
(System.Threading.Thread) doing a (Sleep/Notify Elapsed) loop.
What do you think about this early implementation?

Somebody could explain more clearly the differences between
Threading.Timer and Timers.Timer?

Best regards

Gustavo.




> > 2. I'm interested in implement the System.Timers namespace. Are
there any
> > problem? What is the procedure? I implement it and send you?
> 
> You mean System.Threading.Timer?  That would be nice, but you might
want
> to discuss your implementation strategy on the mailing list.  I saw
that
> Dick was the last person touching that code, and it would be nice to
> hear what he thinks about this.
> 
> There are a number of questions to ponder:
> 
> 	* Are timer functions invoked on the same thread or a separate	
> 	  thread?  This will tell you whether you have to implement
> 	  the timers using just a separate thread and sleeping, or not.
> 
> 	* Are timers supposed to be invoked during a main loop
> 	  invocation, or will be triggered even if you are busy?
> 
> 	  This will tell you whether you have to use SIGITIMER, or if
> 	  you can get away with running some main loop.
>