diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-04-16 12:01:03 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-04-16 13:44:05 +1000 |
commit | ddc126637404cb3d9356b7698779dcd8849f8718 (patch) | |
tree | 936c57b3874288ac96d8198a11e34809f76ceaab /src | |
parent | 98ecb5233bb3b899bd696a90d2733c6a345676dd (diff) |
Pre-allocate the reopen timer so we don't allocate during sigio handling.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/evdev.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/evdev.c b/src/evdev.c index 43a90be..6ef1316 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -572,8 +572,11 @@ EvdevReadInput(InputInfoPtr pInfo) xf86RemoveEnabledDevice(pInfo); close(pInfo->fd); pInfo->fd = -1; - pEvdev->reopen_left = pEvdev->reopen_attempts; - pEvdev->reopen_timer = TimerSet(NULL, 0, 100, EvdevReopenTimer, pInfo); + if (pEvdev->reopen_timer) + { + pEvdev->reopen_left = pEvdev->reopen_attempts; + pEvdev->reopen_timer = TimerSet(pEvdev->reopen_timer, 0, 100, EvdevReopenTimer, pInfo); + } } else if (errno != EAGAIN) xf86Msg(X_ERROR, "%s: Read error: %s\n", pInfo->name, strerror(errno)); @@ -1246,7 +1249,7 @@ EvdevOn(DeviceIntPtr device) if (pInfo->fd == -1) { pEvdev->reopen_left = pEvdev->reopen_attempts; - pEvdev->reopen_timer = TimerSet(NULL, 0, 100, EvdevReopenTimer, pInfo); + pEvdev->reopen_timer = TimerSet(pEvdev->reopen_timer, 0, 100, EvdevReopenTimer, pInfo); } else { pEvdev->min_maj = EvdevGetMajorMinor(pInfo); @@ -1257,6 +1260,8 @@ EvdevOn(DeviceIntPtr device) return !Success; } + pEvdev->reopen_timer = TimerSet(pEvdev->reopen_timer, 0, 0, NULL, NULL); + xf86FlushInput(pInfo->fd); xf86AddEnabledDevice(pInfo); EvdevMBEmuOn(pInfo); |