[Mono-dev] Call for testing: -- Timer issue

Alan McGovern alan.mcgovern at gmail.com
Fri Apr 27 13:54:04 EDT 2007


Any update on this issue?

Alan.

On 4/21/07, Joshua Tauberer <jit at occams.info> wrote:
>
> With the 1.2.4 preview, I encountered something with the MySql Connector
> which I narrowed down to an issue with System.Threading.Timer. I don't
> know what the proper way to use the Timer is, so it may be improper use
> on MySql's end, but nevertheless it's unexpected.
>
> When creating and disposing a bunch of timers from various threads, very
> quickly a deadlock (or something near enough) occurs.
>
> I'm attaching a test program. I expect the program to come to
> completion, but inevitably one of the threads gets stuck creating a
> timer. This is on a single-processor x86-32.
>
> (In MySQL, this comes up in the Command Timeout.)
>
> TIA for looking into this for whoever knows about that part of Mono.
>
> - Josh
>
> using System;
> using System.Threading;
>
> public class Test {
>         public static void Main(string[] arg) {
>                 for (int i = 0; i < 10; i++)
>                         new Thread(new Test(i).Runner).Start();
>         }
>
>         int tid;
>         Timer timer;
>
>         public Test(int tid) { this.tid = tid; }
>
>         public void Runner() {
>                 Console.Error.WriteLine("Thread {0} Starting", tid);
>
>                 timer = new Timer(Callback, null, 50, 50);
>                 //timer.Dispose(); // MySQL disposes right away in the
> usual case
>
>                 Console.Error.WriteLine("Thread {0} Finished", tid);
>         }
>
>         void Callback(object state) {
>                 Console.Error.WriteLine("Callback on Thread: {0}", tid);
>                 timer.Dispose();
>         }
> }
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070427/a65ab1ae/attachment.html 


More information about the Mono-devel-list mailing list