diff --git a/app/src/main/jni/evdev_reader/evdev_reader.c b/app/src/main/jni/evdev_reader/evdev_reader.c index 8c757ce9..00c0ccc8 100644 --- a/app/src/main/jni/evdev_reader/evdev_reader.c +++ b/app/src/main/jni/evdev_reader/evdev_reader.c @@ -132,6 +132,9 @@ cleanup: { struct DeviceEntry *lastEntry; + // Lock the device list + pthread_mutex_lock(&DeviceListLock); + if (DeviceListHead == device) { DeviceListHead = device->next; } @@ -146,6 +149,9 @@ cleanup: lastEntry = lastEntry->next; } } + + // Unlock device list + pthread_mutex_unlock(&DeviceListLock); } // Free the context