summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKrzysztof Sommerfeld <[email protected]>2023-12-06 23:12:20 +0100
committerKrzysztof Sommerfeld <[email protected]>2023-12-15 17:12:38 +0000
commit03ef30d97502e692556924315e149122b9f981ea (patch)
treee38b13f34c14fc3bb74992409861b2e90287dbff /src
parent9d8473cdf63537dee65e9c235249b4e4901baa1a (diff)
Recreate posix QSystemSemaphore on release for VxWorks
`QSystemSemaphore` used by `QSharedMemory` class, when failed to acquire native sem by calling `sem_wait`, will check the reason of failure and if it is because the semaphore is no longer valid (destroyed by some other `QSharedMemory` object accessing the same data) will recreate it and repeat. However, the same is not done when `QSystemSemaphore` is calling release. Add this functionality also for release. Task-number: QTBUG-115777 Pick-to: 6.7 Change-Id: Ic5d2438c93db318b993becff930b480fd3177532 Reviewed-by: Thiago Macieira <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/ipc/qsystemsemaphore_posix.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/ipc/qsystemsemaphore_posix.cpp b/src/corelib/ipc/qsystemsemaphore_posix.cpp
index 0de59e219a3..7df9593513c 100644
--- a/src/corelib/ipc/qsystemsemaphore_posix.cpp
+++ b/src/corelib/ipc/qsystemsemaphore_posix.cpp
@@ -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);