diff options
author | Keith Packard <keithp@keithp.com> | 2016-05-29 01:14:59 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2016-05-29 19:21:15 -0700 |
commit | 06bdc3bc1aeca2635d0f711ac7eef34796e28339 (patch) | |
tree | 4fb2744714094f0fc5dea58c6cc84cae6c8957f4 /os/inputthread.c | |
parent | de3620065945f199a203afb831cac99bb8bff75b (diff) |
os: fix input_mutex_count off-by-one in input_force_unlock
input_force_unlock was mis-using input_mutex_lock and leaving it set
to -1. As this is executed from OsInit at each server generation, on
the second time through, the mutex would be left locked (!) due to the
trylock call. This caused input to fail after the first server reset.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'os/inputthread.c')
-rw-r--r-- | os/inputthread.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/os/inputthread.c b/os/inputthread.c index b6bbf3509..390b66bf9 100644 --- a/os/inputthread.c +++ b/os/inputthread.c @@ -109,9 +109,10 @@ void input_force_unlock(void) { if (pthread_mutex_trylock(&input_mutex) == 0) { + input_mutex_count++; /* unlock +1 times for the trylock */ - while (input_mutex_count-- >= 0) - pthread_mutex_unlock(&input_mutex); + while (input_mutex_count > 0) + input_unlock(); } } |