Many programs write this in the creation thread:
............
Threadhandle = CreateThread (null,0,.....);
Closehandel (Threadhandle);
。。。。。
This is not just created and closed again. How does the thread work?
For:
Closing A thread handle does not terminate the associated thread. To remove a thread object, you must terminate the thread, then close all handles to the thread.
Quote from MSDN
1, Thread and line Cheng (Handle) is not a thing, the thread is running on the CPU ... (It's not clear), the thread handle is a kernel object. We can manipulate threads through handles, but the life cycle of threads is different from the lifecycle of thread handles. The life cycle of a thread is the thread function from the start to the return, and the thread handle's lifecycle is returned from CreateThread to your CloseHandle ().
2, all the kernel objects (including thread handle) are system resources, used to return, that is, after use must be CloseHandle closed, if not to do so, your system's handle resources quickly ran out.
3, if you createthread later need to do some operations on this thread, such as the change of priority, by other threads waiting, forced termatethread and so on, it is necessary to save this handle, used in CloseHandle. If you open a thread and do not need to intervene on it, CreateThread directly closehandle the line.
So
Closehandel (Threadhandle);
Just closed a thread handle object, which means that I no longer use the handle, that is, no interference to the thread corresponding to the handle. There is no end thread.
If you think you have one more variable, you can write it as:
Closehandel (CreateThread (null,0,.....));
Article Source: DIY Tribe (http://www.diybl.com/course/3_program/c++/cppjs/20090208/155031.html)