[Mono-dev] System.Timers.Timer bug

Jakubec Vojtech vojtech.jakubec at strom.cz
Tue Jun 13 12:44:35 EDT 2006


Hi,

I found a multi-threading problem in implementation of System.Timers.Timer class. In our application we are using Timer.Enabled property inside of ElapsedEventHandler method to prevent timer from raising the Elapsed event again while previous handler is still running. In some cases Timer can be disabled and enabled again very fast. 

 

The problem under Mono is with member ManualResetEvent wait. In some cases new thread created by enabling Timer starts and creates instance of wait object before the old thread ends. Then the old thread dispose wait object and new thread throws unhandled NullRefrenceException.

 

I'm attaching modified System.Timers.Timer class from Mono-1.1.15 sources with possible solution.

 

Regards,

Vojtech Jakubec

Telco software development (VAS)

 

STROM telecom, a.s.

 

 

Tel.: +420 211 029 248

BB Cenrum - Beta, Vyskočilova 1461/2a, 140 00  Praha 4, Czech Republic

www.strom.cz <http://www.strom.cz/> 


DISCLAIMER
This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060613/6f78e491/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Timer.cs
Type: application/octet-stream
Size: 5376 bytes
Desc: Timer.cs
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060613/6f78e491/attachment.obj 


More information about the Mono-devel-list mailing list