I suppose the other thread could close or shutdown the socket which would flag the error fd_set and break out of the select() block.

I generally run an infinite loop with a reasonable timeout for the select() timeval ("reasonable" requires some experimenting), then break out of the loop once all data have been read or written.