summaryrefslogtreecommitdiff
path: root/os
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2017-02-23 10:21:49 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2017-02-27 09:25:08 +1000
commit1b12249fd6d4d3b566043d556503f3f625b9b4ba (patch)
tree7f971669122c52f218c2907fbd9a59db298c788f /os
parent7d7788e0f2fbbf5d05cb918df11a5e1b7e047e48 (diff)
os: log a bug whenever WriteToClient is called from the input thread
The input thread should generate events, not send them. Make it easier to find the instances where it's doing so. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Tested-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Diffstat (limited to 'os')
-rw-r--r--os/inputthread.c8
-rw-r--r--os/io.c3
2 files changed, 11 insertions, 0 deletions
diff --git a/os/inputthread.c b/os/inputthread.c
index 4400fba3f..e7159c70a 100644
--- a/os/inputthread.c
+++ b/os/inputthread.c
@@ -90,6 +90,13 @@ static pthread_mutex_t input_mutex;
static Bool input_mutex_initialized;
#endif
+int
+in_input_thread(void)
+{
+ return inputThreadInfo &&
+ pthread_equal(pthread_self(), inputThreadInfo->thread);
+}
+
void
input_lock(void)
{
@@ -531,6 +538,7 @@ void input_force_unlock(void) {}
void InputThreadPreInit(void) {}
void InputThreadInit(void) {}
void InputThreadFini(void) {}
+int in_input_thread(void) { return 0; }
int InputThreadRegisterDev(int fd,
NotifyFdProcPtr readInputProc,
diff --git a/os/io.c b/os/io.c
index be85226dd..8aa51a107 100644
--- a/os/io.c
+++ b/os/io.c
@@ -651,6 +651,9 @@ WriteToClient(ClientPtr who, int count, const void *__buf)
int padBytes;
const char *buf = __buf;
+ BUG_RETURN_VAL_MSG(in_input_thread(), 0,
+ "******** %s called from input thread *********\n", __func__);
+
#ifdef DEBUG_COMMUNICATION
Bool multicount = FALSE;
#endif