[Mono-bugs] [Bug 335579] New: All threads from the pool have the same value for Thread. ManagedThreadId

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Oct 22 05:04:12 EDT 2007


https://bugzilla.novell.com/show_bug.cgi?id=335579

           Summary: All threads from the pool have the same value for
                    Thread.ManagedThreadId
           Product: Mono: Class Libraries
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Core
        AssignedTo: mono-bugs at ximian.com
        ReportedBy: lluis at novell.com
         QAContact: mono-bugs at ximian.com
          Found By: ---


ThreadPool threads don't initialize its ManagedThreadId value, so it always
returns 0.

Test case:

using System;
using System.Threading;

public class Bla 
{
        public static void Main ()
        {
                Console.WriteLine ("id1:" +
Thread.CurrentThread.ManagedThreadId);
                System.Threading.ThreadPool.QueueUserWorkItem (AnotherThread);
                System.Threading.ThreadPool.QueueUserWorkItem (AnotherThread);
                System.Threading.ThreadPool.QueueUserWorkItem (AnotherThread);
                Thread.Sleep (100);
        }

        static void AnotherThread (object o)
        {
                Console.WriteLine ("id2:" +
Thread.CurrentThread.ManagedThreadId);
        }
}

It prints:

id1:0
id2:0
id2:0
id2:0

It should print:

id1:0
id2:1
id2:2
id2:3


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list