[Mono-list] ThreadPool's behaviors are different from microsoft dotNet's

Rodrigo Kumpera kumpera at gmail.com
Sun Apr 1 18:00:33 UTC 2012


This looks like a bug on Mono, can you file a bug report or, even better,
make a pull request with a test and the fix.



On Sun, Apr 1, 2012 at 9:24 AM, hayate <hayatelee at gmail.com> wrote:

> Here is the simple code:
>
> using System;
> using System.Threading;
>
> public class Example {
>     public static void Main() {
>         // Queue the task.
>         ThreadPool.QueueUserWorkItem(new WaitCallback(ThreadProc));
>
>         Console.WriteLine("Main thread does some work, then sleeps.");
>
>         Thread.Sleep(1000);
>
>         Console.WriteLine("Main thread exits.");
>     }
>
>     // This thread procedure performs the task.
>     static void ThreadProc(Object stateInfo) {
>         Thread.CurrentThread.Name = "My Worker";
>         Console.WriteLine("Hello from the thread pool.");
>     }
> }
>
> On Mono there will be an exception on the thread name assignment line,
> saying that "Thread name can only be set once". The same code works on
> Microsoft DotNet platform.
>
> Since I'm porting some code, so is there any chance I can name a thread of
> threadpool?
> Thanks.
>
>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20120401/9b59e43e/attachment.html>


More information about the Mono-list mailing list