[Mono-list] ThreadPool's behaviors are different from microsoft dotNet's
hayate
hayatelee at gmail.com
Sun Apr 1 12:24:12 UTC 2012
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20120401/268cfe9e/attachment.html>
More information about the Mono-list
mailing list