[m-dev.] sem_wait and EINTR
Peter Wang
novalazy at gmail.com
Mon Jul 3 16:46:27 AEST 2017
Hi,
I noticed that we have calls to MR_SEM_WAIT and MR_SEM_TIMED_WAIT that
do not handle a premature return when the call is interrupted by a
signal. We should wrap the calls like this:
int err;
do {
err = MR_SEM_WAIT(sem, "blah");
} while (err == -1 && MR_is_eintr(errno));
The MR_SEM_* macros may be implemented with libdispatch.
Does anyone know if libdispatch functions set errno on error?
The dispatch_semaphore_wait manual page does not mention EINTR so I
assume it will not return prematurely (good), but if it doesn't set
errno on error then testing errno there would be incorrect.
Peter
More information about the developers
mailing list