Skip to content

Commit 652e730

Browse files
committed
Auto merge of #453 - nix-rust:asomers-kevent, r=posborne
Asomers kevent This is a rebase of @asomers work on master to resolve a merge conflict so we can get things merged up.
2 parents ff4484d + a0058f0 commit 652e730

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
2020
### Changed
2121
- The minimum supported version of rustc is now 1.7.0.
2222
([#444](https://github.com/nix-rust/nix/pull/444))
23+
- Implement `Send` for `KEvent`
24+
([#442](https://github.com/nix-rust/nix/pull/442))
2325
- Changed `KEvent` to an opaque structure that may only be modified by its
2426
constructor and the `ev_set` method.
2527
([#415](https://github.com/nix-rust/nix/pull/415))

src/sys/event.rs

+7
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,13 @@ pub fn kqueue() -> Result<RawFd> {
191191
Errno::result(res)
192192
}
193193

194+
195+
// KEvent can't derive Send because on some operating systems, udata is defined
196+
// as a void*. However, KEvent's public API always treats udata as a uintptr_t,
197+
// which is safe to Send.
198+
unsafe impl Send for KEvent {
199+
}
200+
194201
impl KEvent {
195202
pub fn new(ident: uintptr_t, filter: EventFilter, flags: EventFlag,
196203
fflags:FilterFlag, data: intptr_t, udata: uintptr_t) -> KEvent {

0 commit comments

Comments
 (0)