summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-02-12 11:59:52 +0000
committerAdam Jackson <ajax@redhat.com>2016-02-29 14:33:11 -0500
commitbc3634010c096dffd1935c0c6cf8ba37534ae3d8 (patch)
tree9c56da7859efa72eacaf9c36aa7bb42660dbffef
parent9fecc4cd571641f8920f25473ce5abb3fdca8b40 (diff)
dix: Add ClientSignalAll()
This is a variant of ClientSignal() that signals all clients with an optional matching sleeping client, function and closure. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--dix/dixutils.c22
-rw-r--r--include/dix.h8
2 files changed, 30 insertions, 0 deletions
diff --git a/dix/dixutils.c b/dix/dixutils.c
index 205550eb4..b6b002385 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -620,6 +620,28 @@ ClientSignal(ClientPtr client)
return FALSE;
}
+int
+ClientSignalAll(ClientPtr client, ClientSleepProcPtr function, void *closure)
+{
+ SleepQueuePtr q;
+ int count = 0;
+
+ for (q = sleepQueue; q; q = q->next) {
+ if (!(client == CLIENT_SIGNAL_ANY || q->client == client))
+ continue;
+
+ if (!(function == CLIENT_SIGNAL_ANY || q->function == function))
+ continue;
+
+ if (!(closure == CLIENT_SIGNAL_ANY || q->closure == closure))
+ continue;
+
+ count += QueueWorkProc(q->function, q->client, q->closure);
+ }
+
+ return count;
+}
+
void
ClientWakeup(ClientPtr client)
{
diff --git a/include/dix.h b/include/dix.h
index 921156b4c..d49d05569 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -255,6 +255,14 @@ extern _X_EXPORT Bool ClientSleep(ClientPtr client,
extern _X_EXPORT Bool ClientSignal(ClientPtr /*client */ );
#endif /* ___CLIENTSIGNAL_DEFINED___ */
+#ifndef ___CLIENTSIGNALALL_DEFINED___
+#define ___CLIENTSIGNALALL_DEFINED___
+#define CLIENT_SIGNAL_ANY ((void *)-1)
+extern _X_EXPORT int ClientSignalAll(ClientPtr /*client*/,
+ ClientSleepProcPtr /*function*/,
+ void * /*closure*/);
+#endif /* ___CLIENTSIGNALALL_DEFINED___ */
+
extern _X_EXPORT void ClientWakeup(ClientPtr /*client */ );
extern _X_EXPORT Bool ClientIsAsleep(ClientPtr /*client */ );