But I get EINVAL = Invalid argument. Seems like file descriptors are thread specific.
How to do an asynchronous select() ?
I don’t think file descriptors are thread specific.
Most of your parameters to select are pointers. But what do they point to? If they point to structures on the stack, that would be bad, because those structures will be gone by the time the select runs.