Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

impl Send for KEvent #442

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
([#410](https://github.com/nix-rust/nix/pull/410))

### Changed
- Implement `Send` for `KEvent`
([#442](https://github.com/nix-rust/nix/pull/442))
- Changed `KEvent` to an opaque structure that may only be modified by its
constructor and the `ev_set` method.
([#415](https://github.com/nix-rust/nix/pull/415))
Expand Down
7 changes: 7 additions & 0 deletions src/sys/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,13 @@ pub fn kqueue() -> Result<RawFd> {
Errno::result(res)
}


// KEvent can't derive Send because on some operating systems, udata is defined
// as a void*. However, KEvent's public API always treats udata as a uintptr_t,
// which is safe to Send.
unsafe impl Send for KEvent {
}

impl KEvent {
pub fn new(ident: uintptr_t, filter: EventFilter, flags: EventFlag,
fflags:FilterFlag, data: intptr_t, udata: uintptr_t) -> KEvent {
Expand Down