Commit 8db52b67 authored by Drew's avatar Drew

More patching for SR-761

parent 09a88507
From 4797488a72649ed0ea1ad65e9cc920cfb4c4b15d Mon Sep 17 00:00:00 2001
From: Hubertus Franke <frankeh@us.ibm.com>
Date: Mon, 29 Feb 2016 18:05:57 -0500
Subject: [PATCH 1/2] inform libpwq thread manager before semaphore wait
---
src/semaphore.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/semaphore.c b/src/semaphore.c
index 5c1a0ff..cc6c6c1 100644
--- a/src/semaphore.c
+++ b/src/semaphore.c
@@ -301,6 +301,13 @@ dispatch_semaphore_signal(dispatch_semaphore_t dsema)
return _dispatch_semaphore_signal_slow(dsema);
}
+#if (USE_POSIX_SEM || USE_FUTEX_SEM) && HAVE_PTHREAD_WORKQUEUES
+extern void pthread_workqueue_signal_np(void);
+#define _dispatch_threadmgr_inform_wait() pthread_workqueue_signal_np()
+#else
+#define _dispatch_threadmgr_inform_wait() do { } while (0)
+#endif
+
DISPATCH_NOINLINE
static long
_dispatch_semaphore_wait_slow(dispatch_semaphore_t dsema,
@@ -371,6 +378,7 @@ again:
uint64_t nsec = _dispatch_time_to_nanoseconds(timeout);
_timeout.tv_sec = (typeof(_timeout.tv_sec))(nsec / NSEC_PER_SEC);
_timeout.tv_nsec = (typeof(_timeout.tv_nsec))(nsec % NSEC_PER_SEC);
+ _dispatch_threadmgr_inform_wait();
ret = slowpath(sem_timedwait(&dsema->dsema_sem, &_timeout));
} while (ret == -1 && errno == EINTR);
@@ -383,6 +391,7 @@ again:
uint64_t nsec = _dispatch_timeout(timeout);
_timeout.tv_sec = (typeof(_timeout.tv_sec))(nsec / NSEC_PER_SEC);
_timeout.tv_nsec = (typeof(_timeout.tv_nsec))(nsec % NSEC_PER_SEC);
+ _dispatch_threadmgr_inform_wait();
ret = slowpath(_dispatch_futex_wait(&dsema->dsema_futex, &_timeout));
} while (ret == false && errno == EINTR);
@@ -425,11 +434,13 @@ again:
DISPATCH_SEMAPHORE_VERIFY_KR(kr);
#elif USE_POSIX_SEM
do {
+ _dispatch_threadmgr_inform_wait();
ret = sem_wait(&dsema->dsema_sem);
} while (ret != 0);
DISPATCH_SEMAPHORE_VERIFY_RET(ret);
#elif USE_FUTEX_SEM
do {
+ _dispatch_threadmgr_inform_wait();
ret = _dispatch_futex_wait(&dsema->dsema_futex, NULL);
} while (ret == false && errno == EINTR);
DISPATCH_SEMAPHORE_VERIFY_RET(ret);
@@ -636,6 +647,7 @@ again:
uint64_t nsec = _dispatch_time_to_nanoseconds(timeout);
_timeout.tv_sec = (typeof(_timeout.tv_sec))(nsec / NSEC_PER_SEC);
_timeout.tv_nsec = (typeof(_timeout.tv_nsec))(nsec % NSEC_PER_SEC);
+ _dispatch_threadmgr_inform_wait();
ret = slowpath(sem_timedwait(&dsema->dsema_sem, &_timeout));
} while (ret == -1 && errno == EINTR);
@@ -648,6 +660,7 @@ again:
uint64_t nsec = _dispatch_timeout(timeout);
_timeout.tv_sec = (typeof(_timeout.tv_sec))(nsec / NSEC_PER_SEC);
_timeout.tv_nsec = (typeof(_timeout.tv_nsec))(nsec % NSEC_PER_SEC);
+ _dispatch_threadmgr_inform_wait();
ret = slowpath(_dispatch_futex_wait(&dsema->dsema_futex, &_timeout));
} while (ret == false && errno == EINTR);
@@ -690,11 +703,13 @@ again:
DISPATCH_GROUP_VERIFY_KR(kr);
#elif USE_POSIX_SEM
do {
+ _dispatch_threadmgr_inform_wait();
ret = sem_wait(&dsema->dsema_sem);
} while (ret == -1 && errno == EINTR);
DISPATCH_SEMAPHORE_VERIFY_RET(ret);
#elif USE_FUTEX_SEM
do {
+ _dispatch_threadmgr_inform_wait();
ret = _dispatch_futex_wait(&dsema->dsema_futex, NULL);
} while (ret == false && errno == EINTR);
DISPATCH_SEMAPHORE_VERIFY_RET(ret);
--
2.6.4 (Apple Git-63)
From fec9fce023f96a05b0998dbe410a8227e670b7d2 Mon Sep 17 00:00:00 2001
From: Drew Crawford <drew@sealedabstract.com>
Date: Tue, 1 Mar 2016 05:22:01 -0600
Subject: [PATCH 2/2] Update libpwq to upstream master
---
libpwq | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libpwq b/libpwq
index 4312f99..e16bcd6 160000
--- a/libpwq
+++ b/libpwq
@@ -1 +1 @@
-Subproject commit 4312f994da24d35fb355ad6701418752ab8fdf3a
+Subproject commit e16bcd6c4b4df3fd85939a981baf94b30968a1ba
--
2.6.4 (Apple Git-63)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment