From df84d2567179e9d8867957c089683d753016bd75 Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Sun, 9 Aug 2015 04:32:54 +0000 Subject: Vendor import apr-1.5.2 --- locks/unix/proc_mutex.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'locks/unix') diff --git a/locks/unix/proc_mutex.c b/locks/unix/proc_mutex.c index fa8a872f1f8a9..32012a7613cfe 100644 --- a/locks/unix/proc_mutex.c +++ b/locks/unix/proc_mutex.c @@ -114,7 +114,9 @@ static apr_status_t proc_mutex_posix_create(apr_proc_mutex_t *new_mutex, usec = apr_time_usec(now); apr_snprintf(semname, sizeof(semname), "/ApR.%lxZ%lx", sec, usec); } - psem = sem_open(semname, O_CREAT | O_EXCL, 0644, 1); + do { + psem = sem_open(semname, O_CREAT | O_EXCL, 0644, 1); + } while (psem == (sem_t *)SEM_FAILED && errno == EINTR); if (psem == (sem_t *)SEM_FAILED) { if (errno == ENAMETOOLONG) { /* Oh well, good try */ @@ -122,7 +124,9 @@ static apr_status_t proc_mutex_posix_create(apr_proc_mutex_t *new_mutex, } else { return errno; } - psem = sem_open(semname, O_CREAT | O_EXCL, 0644, 1); + do { + psem = sem_open(semname, O_CREAT | O_EXCL, 0644, 1); + } while (psem == (sem_t *)SEM_FAILED && errno == EINTR); } if (psem == (sem_t *)SEM_FAILED) { @@ -140,7 +144,12 @@ static apr_status_t proc_mutex_posix_create(apr_proc_mutex_t *new_mutex, static apr_status_t proc_mutex_posix_acquire(apr_proc_mutex_t *mutex) { - if (sem_wait(mutex->psem_interproc) < 0) { + int rc; + + do { + rc = sem_wait(mutex->psem_interproc); + } while (rc < 0 && errno == EINTR); + if (rc < 0) { return errno; } mutex->curr_locked = 1; @@ -149,7 +158,12 @@ static apr_status_t proc_mutex_posix_acquire(apr_proc_mutex_t *mutex) static apr_status_t proc_mutex_posix_tryacquire(apr_proc_mutex_t *mutex) { - if (sem_trywait(mutex->psem_interproc) < 0) { + int rc; + + do { + rc = sem_trywait(mutex->psem_interproc); + } while (rc < 0 && errno == EINTR); + if (rc < 0) { if (errno == EAGAIN) { return APR_EBUSY; } -- cgit v1.2.3