Quote:
Originariamente inviato da andbin
La documentazione dice:
CloseHandle invalidates the specified object handle, decrements the object's handle count, and performs object retention checks. After the last handle to an object is closed, the object is removed from the system.
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. Quindi sarei portato a pensare che se chiudi subito l'handle appena dopo aver creato/avviato il thread non ci sono problemi.
|
E' quel "
then close all handles".
Io generalmente, in questi casi chiudo l'handle subito prima del return della callback, ma mi è sempre rimasto il dubbio che non fosse propriamente corretto, in quanto il thread termina solo dopo il return.