When running Open Sshd over cygwin on Windows Operating System it is advisable when ending a session to force the remote application to exit before attempting to call SshSession::close() or SshClient::disconnect() .
Under high volume cygwin has shown, on a occasion, remote applications to be alive even when instructed to terminate them with the execution of SshSession::close() or SshClient::disconnect().
It can seem that the close() and disconnect() methods have entered a fatal deadlock scenario but infact the methods are merely waiting for the Sshd to return a succesful acknowledgement.
If these methods seem to hang always force the remote application to end first, in the example of a remote Shell, calling exit will terminate the active Shell sending the awaiting Sshd a termination acknowledgement and respectively this acknowledgement is sent back up the chain to the SshSession::close() or SshClient::disconnect() method which should then return.
It is always good practice to end the remote application first before calling these methods.