Attach an instance of the class to the current thread
A boolean value which specifies if the client could be attached to the current thread. If this method returns false, the client could not be attached to the thread and the application should check the value of the LastError property to determine the cause of the failure.
When an instance of the class is created it is associated with the current thread that created it. Normally, if another thread attempts to perform an operation using that instance, an error is returned. This is used to ensure that other threads cannot interfere with an operation being performed by the owner thread. In some cases, it may be desirable for one thread in an application to create an instance of the class, establish a connection and then pass that instance to another worker thread. The AttachThread method can be used to change the ownership of the class instance to the new worker thread.
This method should be called by the new thread immediately after it has been created, and if the new thread does not release the handle itself, the ownership of the handle should be restored by the original thread. Under no circumstances should AttachThread be used to forcibly destroy an instance of a class allocated by another thread while a blocking operation is in progress. To cancel a blocking operation, use the Cancel method and then delete the class instance after the blocking function exits and control is returned to the current thread.
DnsClient Class | SocketTools Namespace | ThreadModel Property | ThreadModelAttribute Class