Thread ID and Thread Handle

"The thread handle has some access rights to the thread object. The thread ID uniquely identifies the thread at the system level while the thread is running. This relationship is similar to that of the process handle and the process ID."

 

To my understanding, handle is what you use to control the kernel object while ID is just a name that differs from other objects. An kernel object may have more than one handle to it (through OpenThread(), DuplicateHandle(), etc.) but only one ID.

 

On many occasions you have to get one from the other, and here is the way:

 

Handle ----> ID: GetThreadId()

ID ----> Handl: OpenThread(), DuplicateHandle()

posted @ 2010-03-07 15:47  tonyyang132  阅读(505)  评论(0编辑  收藏  举报