[Mono-dev] Re: System.Timers.Timer bug

Robert Jordan robertj at gmx.net
Fri Jun 16 06:30:08 EDT 2006


Jakubec Vojtech wrote:
> 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.

It's similar to this bug & patch:

http://bugzilla.ximian.com/show_bug.cgi?id=77847

Robert




More information about the Mono-devel-list mailing list