wait on mutex before checking if disconnect handler is called