You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Marc Lewandowski <ma...@telebill.com> on 2006/08/09 18:12:10 UTC
Why ThreadId and not Hash Code?
>From the .NET SDK:
GetHashCode
<ms-help://MS.MSDNQTR.2003OCT.1033/cpref/html/frlrfsystemobjectclassgethashc
odetopic.htm> provides identification for managed threads. For the lifetime
of your thread, it will not collide with the value from any other thread,
regardless of the application domain from which you obtain the value.
Note An operating-system ThreadId has no fixed relationship to a managed
thread, because an unmanaged host can control the relationship between
managed and unmanaged threads. Specifically, a sophisticated host can use
the CLR Hosting API to schedule many managed threads against the same
operating system thread, or to move a managed thread between different
operating system threads.
So, why does log4net use the OS thread id? Is this behavior configurable?
-Marc
_____
Marc A. Lewandowski
Director of IT
TeleBill, Inc.
RE: Why ThreadId and not Hash Code?
Posted by Oren Eini <or...@we-can.co.il>.
Because you may need to know the thread's OS id.
And because while it may change threads under you, I'm not aware of a
host that actually does this.
From: Marc Lewandowski [mailto:marc@telebill.com]
Sent: Wednesday, August 09, 2006 7:12 PM
To: 'Log4NET User'
Subject: Why ThreadId and not Hash Code?
>From the .NET SDK:
GetHashCode
<ms-help://MS.MSDNQTR.2003OCT.1033/cpref/html/frlrfsystemobjectclassgeth
ashcodetopic.htm> provides identification for managed threads. For the
lifetime of your thread, it will not collide with the value from any
other thread, regardless of the application domain from which you obtain
the value.
Note An operating-system ThreadId has no fixed relationship to
a managed thread, because an unmanaged host can control the relationship
between managed and unmanaged threads. Specifically, a sophisticated
host can use the CLR Hosting API to schedule many managed threads
against the same operating system thread, or to move a managed thread
between different operating system threads.
So, why does log4net use the OS thread id? Is this behavior
configurable?
-Marc
________________________________
Marc A. Lewandowski
Director of IT
TeleBill, Inc.
Re: Why ThreadId and not Hash Code?
Posted by Ron Grabowski <ro...@yahoo.com>.
What property on the System.Threading.Thread.CurrentThread object are
you referring to? Are you wanting a %threadHashCode pattern that does
this:
System.Threading.Thread.CurrentThread.Name.GetHashCode()
You can certainly make a pattern that does that. What are you
suggesting we change/add?
--- Marc Lewandowski <ma...@telebill.com> wrote:
> From the .NET SDK:
>
> GetHashCode
>
<ms-help://MS.MSDNQTR.2003OCT.1033/cpref/html/frlrfsystemobjectclassgethashc
> odetopic.htm> provides identification for managed threads. For the
> lifetime
> of your thread, it will not collide with the value from any other
> thread,
> regardless of the application domain from which you obtain the value.
>
> Note An operating-system ThreadId has no fixed relationship to a
> managed
> thread, because an unmanaged host can control the relationship
> between
> managed and unmanaged threads. Specifically, a sophisticated host can
> use
> the CLR Hosting API to schedule many managed threads against the same
> operating system thread, or to move a managed thread between
> different
> operating system threads.
>
> So, why does log4net use the OS thread id? Is this behavior
> configurable?
>
> -Marc
>
> _____
>
> Marc A. Lewandowski
> Director of IT
> TeleBill, Inc.
>
>
>