what's the difference between the last parameter of CreateThread (LPDWORD lpThreadId) and the return value of CreateThread in function?
Posted on 2003-10-01 10:01:55 by optimus
the last parm has nothing to do with the return value of the thread. I recommend you use KillThread and GetCurrentThread instead of simply "ret" - the thread might continue existing, and at some point your program will crash (if you "ret" several times). At least, that happened to an app of mine- it started a thread for new event , and after it notified me of several events, it always crashed. Win98SE
Posted on 2003-10-01 11:29:53 by Ultrano
probably u didn't catch me.
CreateThread returns a handle of thread, and the last param of CreateThread specify an pointer to receive thread identifier. What's the difference between them?
Posted on 2003-10-01 11:58:15 by optimus
The difference can be found by subtracting the two. But that's not a very useful number to compute. The thread ID identifies the thread to the system, while the handle is an index into the process object table and is used for manipulating the thread. The reason for thread operations going through this table instead of through a direct pointer is compatibility between Windows 95 and Windows NT, which has access right management. On Windows NT, all system information resides in protected system memory. Thus, manipulation by an application of other running threads and other resources in the system has to be carried out using operating system calls and can be restricted by an administrator.
Posted on 2003-10-01 12:42:03 by Sephiroth3
oic. thanks!
Posted on 2003-10-01 13:24:44 by optimus