diff options
author | Alan Somers <asomers@gmail.com> | 2016-09-18 21:17:41 -0600 |
---|---|---|
committer | Alan Somers <asomers@gmail.com> | 2016-12-16 22:56:28 -0700 |
commit | d3f9b96adc81bb862770f330466d2f2e8d9ab1bc (patch) | |
tree | 5afa7e43fa5500877144be10d50665cca5a23e21 /src/sys/time.rs | |
parent | 9b81000bdaa1636017f88609337c972a04effad8 (diff) | |
download | nix-d3f9b96adc81bb862770f330466d2f2e8d9ab1bc.zip |
Add POSIX AIO support
POSIX AIO is a standard for asynchronous file I/O. Read, write, and
fsync operations can all take place in the background, with completion
notification delivered by a signal, by a new thread, by kqueue, or not
at all. This commit supports all standard AIO functions. However,
lio_listio is disabled on macos because it doesn't seem to work, even
though the syscall is present.
The SigEvent class, used for AIO notifications among other things, is
also added.
Also, impl AsRef for TimeVal and TimeSpec
Diffstat (limited to 'src/sys/time.rs')
-rw-r--r-- | src/sys/time.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/sys/time.rs b/src/sys/time.rs index 9048a3ab..0d977045 100644 --- a/src/sys/time.rs +++ b/src/sys/time.rs @@ -59,6 +59,12 @@ const TS_MAX_SECONDS: i64 = ::std::isize::MAX as i64; const TS_MIN_SECONDS: i64 = -TS_MAX_SECONDS; +impl AsRef<timespec> for TimeSpec { + fn as_ref(&self) -> ×pec { + &self.0 + } +} + impl fmt::Debug for TimeSpec { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.debug_struct("TimeSpec") @@ -264,6 +270,12 @@ const TV_MAX_SECONDS: i64 = ::std::isize::MAX as i64; const TV_MIN_SECONDS: i64 = -TV_MAX_SECONDS; +impl AsRef<timeval> for TimeVal { + fn as_ref(&self) -> &timeval { + &self.0 + } +} + impl fmt::Debug for TimeVal { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.debug_struct("TimeVal") |