PDA

View Full Version : CreateThread


coolgroupsdotcom
09-22-2005, 03:16 AM
Anyone know the difference between the thread handle that's returned by CreateThread and the thread ID?

thanks.

bladder
09-22-2005, 04:57 AM
The difference is that there can be multiple handles to the same object (in this case a thread). While each thread has a unique identifier.

ikk
09-22-2005, 11:12 PM
Handle is usually obtained when something is opened, thus later we can perform additional operation using handle with functions that requires handle as parameter, also what is opened it should be closed, in CreateThread case thread should be terminated. But there is also OpenThread function that opens existing thread, and then when we end with that thread, a handle should be closed.
Identifer itself provides less functionality, because when we have it, it doesnt provides additional access to object.
Usually handle is an address in memory and identifier is an index in some array, thus actual value for identifiers vary in rather small values.