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 <[email protected]> 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  -  [email protected]
> http://lists.ximian.com/mailman/listinfo/mono-list
>
>
_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to