Simplify shm_unix using UniqueFd utility class
The SHM implementation now juggles quite a few file descriptors, so a RAII wrapper class helps to simplify resource management a bit.
Also use this to clarify ownership: The AtExit handler closes file descriptors still in use by the detached thread. Invalid file descriptors will not be transferred via SCM_RIGHTS, so currently the race condition is not a real bug -- but it assumes that no new file descriptors are concurrently created in unrelated code (which then might reuse the number and get incorrectly transferred).
Instead:
* The server thread can be given ownership of the memory fd. The memory map itself remains valid even if all related file descriptors are closed.
* Unconditionally use pipe instead of eventfd, so that each side can get independent ownership of one half.
Finally, apply the 1s timeout also to connect().
closes https://github.com/official-stockfish/Stockfish/pull/7019
No functional change