Skip to content

poller wait() code example does not delete() on earlier ? error return. #253

@YpeKingma

Description

@YpeKingma

For safety poller.add() requires:

The source must be delete()d from this Poller before it is dropped.

And the wait() example code has:

unsafe {
    poller.add(&socket, Event::all(key))?;
}

let mut events = Events::new();
let n = poller.wait(&mut events, Some(Duration::from_secs(1)))?;
poller.delete(&socket)?;

The ? at the wait() call may cause an Error return without delete() being called.

Is this example safe?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions