diff options
Diffstat (limited to 'src/corelib/ipc/qsystemsemaphore_posix.cpp')
-rw-r--r-- | src/corelib/ipc/qsystemsemaphore_posix.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/corelib/ipc/qsystemsemaphore_posix.cpp b/src/corelib/ipc/qsystemsemaphore_posix.cpp index b290e14de4..7df9593513 100644 --- a/src/corelib/ipc/qsystemsemaphore_posix.cpp +++ b/src/corelib/ipc/qsystemsemaphore_posix.cpp @@ -20,9 +20,9 @@ #ifdef Q_OS_UNIX # include "private/qcore_unix_p.h" #else -#define EINTR_LOOP_VAL(var, val, cmd) \ +# define QT_EINTR_LOOP_VAL(var, val, cmd) \ (void)var; var = cmd -#define EINTR_LOOP(var, cmd) EINTR_LOOP_VAL(var, -1, cmd) +# define QT_EINTR_LOOP(var, cmd) QT_EINTR_LOOP_VAL(var, -1, cmd) #endif // OpenBSD 4.2 doesn't define EIDRM, see BUGS section: @@ -126,6 +126,12 @@ bool QSystemSemaphorePosix::modifySemaphore(QSystemSemaphorePrivate *self, int c int cnt = count; do { if (::sem_post(semaphore) == -1) { +#if defined(Q_OS_VXWORKS) + if (errno == EINVAL) { + semaphore = SEM_FAILED; + return modifySemaphore(self, cnt); + } +#endif self->setUnixErrorString("QSystemSemaphore::modifySemaphore (sem_post)"_L1); #if defined QSYSTEMSEMAPHORE_DEBUG qDebug("QSystemSemaphorePosix::modify sem_post failed %d %d", count, errno); @@ -133,7 +139,7 @@ bool QSystemSemaphorePosix::modifySemaphore(QSystemSemaphorePrivate *self, int c // rollback changes to preserve the SysV semaphore behavior for ( ; cnt < count; ++cnt) { int res; - EINTR_LOOP(res, ::sem_wait(semaphore)); + QT_EINTR_LOOP(res, ::sem_wait(semaphore)); } return false; } @@ -141,7 +147,7 @@ bool QSystemSemaphorePosix::modifySemaphore(QSystemSemaphorePrivate *self, int c } while (cnt > 0); } else { int res; - EINTR_LOOP(res, ::sem_wait(semaphore)); + QT_EINTR_LOOP(res, ::sem_wait(semaphore)); if (res == -1) { // If the semaphore was removed be nice and create it and then modifySemaphore again if (errno == EINVAL || errno == EIDRM) { |