Determining which threads own which handles?

While debugging, I find myself always wanting to know which thread
owns which handles. Is there a way to determine this?

I’ve figured out how to determine which threads are *waiting* for
which handles by looking at the stack trace and looking for a thread
that invoked “WaitForSingleObject” or its variants. Then, I look at
the parameter and I can determine the handle. But, I can’t seem to
figure out how to tell which thread currently has the handle that the
other thread are waiting for.

Thanks

“Jonathon” wrote in message news:xxxxx@windbg…

But, I can’t seem to figure out how to tell which thread currently has the
handle that the
other thread are waiting for.

What kind of object is this a handle to? Not all objects have ownership
information in them. For example, if a thread is waiting on an event there’s
nothing in the event structure that says who should be the one to set it
(think about how hard that would be to figure out from the O/S perspective).
However, in the case of a mutex the O/S does track the thread that currently
owns the mutex (in kernel mode, at least).

-scott


Scott Noone
Consulting Associate and Chief System Problem Analyst
OSR Open Systems Resources, Inc.
http://www.osronline.com