D
Dave
Nope. Since I've already stipulated that I control the thread that registersNope. Here's the situation:
o You create a thread, and set it for debug
o The thread dies naturally
o A third party library creates a new thread, and it gets the same
hashcode as the first thread
o The third party library writes some debug output
o Oops - you incorrectly include it with your own output
itself, I also control when it terminates so that if necessary it can
deregister itself. Threads don't just disappear unless the application
itself is being unloaded or an exception occurs that cannot be handled by
managed code (e.g. ExecutionEngineException, stack overflow, hardware
failure, etc).
Besides, I question the usefullness of using a simple thread id to control
debug output - it would never capture transients, such as code executing in
a callback from a threadpool because these types of threads come and go
seemingly at random. It would make more sense to capture output based on a
class of thread or an a transaction basis.
Perhaps, but I can't see that my simple system would fail any
requirements that yours would succeed for.
I didn't say it would - you said mine wouldn't work, and it does within the
constraints of how I intended it to be used.
(Yes, you then need to occasionally remove all the mappings which have
a WeakReference where the enclosed reference has been collected, but
that's simple.)
Thus increasing the complexity of the system. Moving the complexity from one
area to another does not eliminate it.
I don't think so, but I think we will have to agree to disagree.It just seems to create an unnecessary weakness in the system.