Skip to content

Commit fa3466b

Browse files
committed
docs: remark that dropping an Evdev can take a while
1 parent 832da0f commit fa3466b

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/evdev.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,19 @@ use crate::{
5555
/// Since multiple [`Evdev`]s can refer to the same file handle, none of the methods require a
5656
/// mutable reference, again mirroring the API of [`TcpStream`].
5757
///
58+
/// # Blocking Drop
59+
///
60+
/// When an [`Evdev`] is dropped, the underlying file descriptor is closed, which can block for a
61+
/// considerable amount of time (50-100 ms).
62+
/// This is happening in the evdev subsystem in the kernel, so there is not much userspace can do
63+
/// about that.
64+
///
65+
/// If this delay is a problem for your application, there are several options:
66+
///
67+
/// - Send the [`Evdev`] to another thread and drop it there.
68+
/// - [`mem::forget`][std::mem::forget] the [`Evdev`] and leak the file descriptor, if that leak is
69+
/// acceptable for your application.
70+
///
5871
/// # Device Lifecycle
5972
///
6073
/// (the observations here were made on Linux, the behavior on FreeBSD may differ a bit)

src/ff.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ impl Effect<'_> {
410410
/// By default, effects use ID `-1`, which is appropriate when uploading a new effect to a
411411
/// device (the input subsystem will allocate an ID for the effect).
412412
///
413-
/// The ID can be set to a existing [`EffectId`] in order to reconfigure an already uploaded
413+
/// The ID can be set to an existing [`EffectId`] in order to reconfigure an already uploaded
414414
/// effect.
415415
#[inline]
416416
pub fn with_id(mut self, id: EffectId) -> Self {

0 commit comments

Comments
 (0)