mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-20 00:00:08 +02:00
chore: fix typos (#3907)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
//! Benchmark implementation details of the theaded scheduler. These benches are
|
||||
//! Benchmark implementation details of the threaded scheduler. These benches are
|
||||
//! intended to be used as a form of regression testing and not as a general
|
||||
//! purpose benchmark demonstrating real-world performance.
|
||||
|
||||
|
||||
@@ -515,7 +515,7 @@ pub trait StreamExt: Stream {
|
||||
/// Skip elements from the underlying stream while the provided predicate
|
||||
/// resolves to `true`.
|
||||
///
|
||||
/// This function, like [`Iterator::skip_while`], will ignore elemets from the
|
||||
/// This function, like [`Iterator::skip_while`], will ignore elements from the
|
||||
/// stream until the predicate `f` resolves to `false`. Once one element
|
||||
/// returns false, the rest of the elements will be yielded.
|
||||
///
|
||||
|
||||
@@ -11,7 +11,7 @@ use tokio::sync::watch::error::RecvError;
|
||||
/// A wrapper around [`tokio::sync::watch::Receiver`] that implements [`Stream`].
|
||||
///
|
||||
/// This stream will always start by yielding the current value when the WatchStream is polled,
|
||||
/// regardles of whether it was the initial value or sent afterwards.
|
||||
/// regardless of whether it was the initial value or sent afterwards.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
|
||||
))]
|
||||
|
||||
//! Tokio and Futures based testing utilites
|
||||
//! Tokio and Futures based testing utilities
|
||||
|
||||
pub mod io;
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ impl ThreadWaker {
|
||||
}
|
||||
}
|
||||
|
||||
/// Clears any previously received wakes, avoiding potential spurrious
|
||||
/// Clears any previously received wakes, avoiding potential spurious
|
||||
/// wake notifications. This should only be called immediately before running the
|
||||
/// task.
|
||||
fn clear(&self) {
|
||||
|
||||
@@ -234,7 +234,7 @@ impl Default for AnyDelimiterCodec {
|
||||
}
|
||||
}
|
||||
|
||||
/// An error occured while encoding or decoding a chunk.
|
||||
/// An error occurred while encoding or decoding a chunk.
|
||||
#[derive(Debug)]
|
||||
pub enum AnyDelimiterCodecError {
|
||||
/// The maximum chunk length was exceeded.
|
||||
|
||||
@@ -28,7 +28,7 @@ use std::io;
|
||||
/// It is up to the Decoder to keep track of a restart after an EOF,
|
||||
/// and to decide how to handle such an event by, for example,
|
||||
/// allowing frames to cross EOF boundaries, re-emitting opening frames, or
|
||||
/// reseting the entire internal state.
|
||||
/// resetting the entire internal state.
|
||||
///
|
||||
/// [`Framed`]: crate::codec::Framed
|
||||
/// [`FramedRead`]: crate::codec::FramedRead
|
||||
|
||||
@@ -124,7 +124,7 @@ where
|
||||
// to a combination of the `is_readable` and `eof` flags. States persist across
|
||||
// loop entries and most state transitions occur with a return.
|
||||
//
|
||||
// The intitial state is `reading`.
|
||||
// The initial state is `reading`.
|
||||
//
|
||||
// | state | eof | is_readable |
|
||||
// |---------|-------|-------------|
|
||||
@@ -155,10 +155,10 @@ where
|
||||
// Both signal that there is no such data by returning `None`.
|
||||
//
|
||||
// If `decode` couldn't read a frame and the upstream source has returned eof,
|
||||
// `decode_eof` will attemp to decode the remaining bytes as closing frames.
|
||||
// `decode_eof` will attempt to decode the remaining bytes as closing frames.
|
||||
//
|
||||
// If the underlying AsyncRead is resumable, we may continue after an EOF,
|
||||
// but must finish emmiting all of it's associated `decode_eof` frames.
|
||||
// but must finish emitting all of it's associated `decode_eof` frames.
|
||||
// Furthermore, we don't want to emit any `decode_eof` frames on retried
|
||||
// reads after an EOF unless we've actually read more data.
|
||||
if state.is_readable {
|
||||
|
||||
@@ -486,7 +486,7 @@ impl LengthDelimitedCodec {
|
||||
// Skip the required bytes
|
||||
src.advance(self.builder.length_field_offset);
|
||||
|
||||
// match endianess
|
||||
// match endianness
|
||||
let n = if self.builder.length_field_is_big_endian {
|
||||
src.get_uint(field_len)
|
||||
} else {
|
||||
|
||||
@@ -203,12 +203,12 @@ impl Default for LinesCodec {
|
||||
}
|
||||
}
|
||||
|
||||
/// An error occured while encoding or decoding a line.
|
||||
/// An error occurred while encoding or decoding a line.
|
||||
#[derive(Debug)]
|
||||
pub enum LinesCodecError {
|
||||
/// The maximum line length was exceeded.
|
||||
MaxLineLengthExceeded,
|
||||
/// An IO error occured.
|
||||
/// An IO error occurred.
|
||||
Io(io::Error),
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ pub enum Either<L, R> {
|
||||
}
|
||||
|
||||
/// A small helper macro which reduces amount of boilerplate in the actual trait method implementation.
|
||||
/// It takes an invokation of method as an argument (e.g. `self.poll(cx)`), and redirects it to either
|
||||
/// It takes an invocation of method as an argument (e.g. `self.poll(cx)`), and redirects it to either
|
||||
/// enum variant held in `self`.
|
||||
macro_rules! delegate_call {
|
||||
($self:ident.$method:ident($($args:ident),+)) => {
|
||||
|
||||
@@ -775,8 +775,8 @@ impl CancellationTokenState {
|
||||
return Poll::Ready(());
|
||||
}
|
||||
|
||||
// So far the token is not cancelled. However it could be cancelld before
|
||||
// we get the chance to store the `Waker`. Therfore we need to check
|
||||
// So far the token is not cancelled. However it could be cancelled before
|
||||
// we get the chance to store the `Waker`. Therefore we need to check
|
||||
// for cancellation again inside the mutex.
|
||||
let mut guard = self.synchronized.lock().unwrap();
|
||||
if guard.is_cancelled {
|
||||
|
||||
@@ -222,7 +222,7 @@ impl<T> LinkedList<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns whether the linked list doesn not contain any node
|
||||
/// Returns whether the linked list does not contain any node
|
||||
pub fn is_empty(&self) -> bool {
|
||||
if self.head.is_some() {
|
||||
return false;
|
||||
|
||||
@@ -228,7 +228,7 @@ It is only possible to implement `AsyncRead` and `AsyncWrite` for resource types
|
||||
themselves and not for `&Resource`. Implementing the traits for `&Resource`
|
||||
would permit concurrent operations to the resource. Because only a single waker
|
||||
is stored per direction, any concurrent usage would result in deadlocks. An
|
||||
alterate implementation would call for a `Vec<Waker>` but this would result in
|
||||
alternate implementation would call for a `Vec<Waker>` but this would result in
|
||||
memory leaks.
|
||||
|
||||
## Enabling reads and writes for `&TcpStream`
|
||||
@@ -268,9 +268,9 @@ select! {
|
||||
}
|
||||
```
|
||||
|
||||
It is also possible to sotre a `TcpStream` in an `Arc`.
|
||||
It is also possible to store a `TcpStream` in an `Arc`.
|
||||
|
||||
```rust
|
||||
let arc_stream = Arc::new(my_tcp_stream);
|
||||
let n = arc_stream.by_ref().read(buf).await?;
|
||||
```
|
||||
```
|
||||
|
||||
@@ -58,7 +58,7 @@ impl Interest {
|
||||
self.0.is_writable()
|
||||
}
|
||||
|
||||
/// Add together two `Interst` values.
|
||||
/// Add together two `Interest` values.
|
||||
///
|
||||
/// This function works from a `const` context.
|
||||
///
|
||||
|
||||
@@ -96,7 +96,7 @@ const ADDRESS: bit::Pack = bit::Pack::least_significant(24);
|
||||
//
|
||||
// The generation prevents a race condition where a slab slot is reused for a
|
||||
// new socket while the I/O driver is about to apply a readiness event. The
|
||||
// generaton value is checked when setting new readiness. If the generation do
|
||||
// generation value is checked when setting new readiness. If the generation do
|
||||
// not match, then the readiness event is discarded.
|
||||
const GENERATION: bit::Pack = ADDRESS.then(7);
|
||||
|
||||
|
||||
@@ -84,9 +84,9 @@ cfg_io_readiness! {
|
||||
|
||||
// The `ScheduledIo::readiness` (`AtomicUsize`) is packed full of goodness.
|
||||
//
|
||||
// | reserved | generation | driver tick | readinesss |
|
||||
// |----------+------------+--------------+------------|
|
||||
// | 1 bit | 7 bits + 8 bits + 16 bits |
|
||||
// | reserved | generation | driver tick | readiness |
|
||||
// |----------+------------+--------------+-----------|
|
||||
// | 1 bit | 7 bits + 8 bits + 16 bits |
|
||||
|
||||
const READINESS: bit::Pack = bit::Pack::least_significant(16);
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ impl<'a> ReadBuf<'a> {
|
||||
|
||||
/// Creates a new `ReadBuf` from a fully uninitialized buffer.
|
||||
///
|
||||
/// Use `assume_init` if part of the buffer is known to be already inintialized.
|
||||
/// Use `assume_init` if part of the buffer is known to be already initialized.
|
||||
#[inline]
|
||||
pub fn uninit(buf: &'a mut [MaybeUninit<u8>]) -> ReadBuf<'a> {
|
||||
ReadBuf {
|
||||
@@ -85,7 +85,7 @@ impl<'a> ReadBuf<'a> {
|
||||
#[inline]
|
||||
pub fn take(&mut self, n: usize) -> ReadBuf<'_> {
|
||||
let max = std::cmp::min(self.remaining(), n);
|
||||
// Saftey: We don't set any of the `unfilled_mut` with `MaybeUninit::uninit`.
|
||||
// Safety: We don't set any of the `unfilled_mut` with `MaybeUninit::uninit`.
|
||||
unsafe { ReadBuf::uninit(&mut self.unfilled_mut()[..max]) }
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ impl<'a> ReadBuf<'a> {
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the filled region of the buffer would become larger than the intialized region.
|
||||
/// Panics if the filled region of the buffer would become larger than the initialized region.
|
||||
#[inline]
|
||||
pub fn set_filled(&mut self, n: usize) {
|
||||
assert!(
|
||||
|
||||
@@ -52,10 +52,10 @@ where
|
||||
|
||||
buf = &buf[..crate::io::blocking::MAX_BUF];
|
||||
|
||||
// Now there are two possibilites.
|
||||
// Now there are two possibilities.
|
||||
// If caller gave is binary buffer, we **should not** shrink it
|
||||
// anymore, because excessive shrinking hits performance.
|
||||
// If caller gave as binary buffer, we **must** additionaly
|
||||
// If caller gave as binary buffer, we **must** additionally
|
||||
// shrink it to strip incomplete char at the end of buffer.
|
||||
// that's why check we will perform now is allowed to have
|
||||
// false-positive.
|
||||
|
||||
@@ -10,12 +10,12 @@ use std::task::{Context, Poll};
|
||||
|
||||
pin_project! {
|
||||
/// Future for the [`read_until`](crate::io::AsyncBufReadExt::read_until) method.
|
||||
/// The delimeter is included in the resulting vector.
|
||||
/// The delimiter is included in the resulting vector.
|
||||
#[derive(Debug)]
|
||||
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||
pub struct ReadUntil<'a, R: ?Sized> {
|
||||
reader: &'a mut R,
|
||||
delimeter: u8,
|
||||
delimiter: u8,
|
||||
buf: &'a mut Vec<u8>,
|
||||
// The number of bytes appended to buf. This can be less than buf.len() if
|
||||
// the buffer was not empty when the operation was started.
|
||||
@@ -28,7 +28,7 @@ pin_project! {
|
||||
|
||||
pub(crate) fn read_until<'a, R>(
|
||||
reader: &'a mut R,
|
||||
delimeter: u8,
|
||||
delimiter: u8,
|
||||
buf: &'a mut Vec<u8>,
|
||||
) -> ReadUntil<'a, R>
|
||||
where
|
||||
@@ -36,7 +36,7 @@ where
|
||||
{
|
||||
ReadUntil {
|
||||
reader,
|
||||
delimeter,
|
||||
delimiter,
|
||||
buf,
|
||||
read: 0,
|
||||
_pin: PhantomPinned,
|
||||
@@ -46,14 +46,14 @@ where
|
||||
pub(super) fn read_until_internal<R: AsyncBufRead + ?Sized>(
|
||||
mut reader: Pin<&mut R>,
|
||||
cx: &mut Context<'_>,
|
||||
delimeter: u8,
|
||||
delimiter: u8,
|
||||
buf: &mut Vec<u8>,
|
||||
read: &mut usize,
|
||||
) -> Poll<io::Result<usize>> {
|
||||
loop {
|
||||
let (done, used) = {
|
||||
let available = ready!(reader.as_mut().poll_fill_buf(cx))?;
|
||||
if let Some(i) = memchr::memchr(delimeter, available) {
|
||||
if let Some(i) = memchr::memchr(delimiter, available) {
|
||||
buf.extend_from_slice(&available[..=i]);
|
||||
(true, i + 1)
|
||||
} else {
|
||||
@@ -74,6 +74,6 @@ impl<R: AsyncBufRead + ?Sized + Unpin> Future for ReadUntil<'_, R> {
|
||||
|
||||
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
||||
let me = self.project();
|
||||
read_until_internal(Pin::new(*me.reader), cx, *me.delimeter, me.buf, me.read)
|
||||
read_until_internal(Pin::new(*me.reader), cx, *me.delimiter, me.buf, me.read)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ where
|
||||
let n = ready!(read_until_internal(
|
||||
me.reader, cx, *me.delim, me.buf, me.read,
|
||||
))?;
|
||||
// read_until_internal resets me.read to zero once it finds the delimeter
|
||||
// read_until_internal resets me.read to zero once it finds the delimiter
|
||||
debug_assert_eq!(*me.read, 0);
|
||||
|
||||
if n == 0 && me.buf.is_empty() {
|
||||
|
||||
@@ -289,7 +289,7 @@
|
||||
/// loop {
|
||||
/// tokio::select! {
|
||||
/// // If you run this example without `biased;`, the polling order is
|
||||
/// // psuedo-random, and the assertions on the value of count will
|
||||
/// // pseudo-random, and the assertions on the value of count will
|
||||
/// // (probably) fail.
|
||||
/// biased;
|
||||
///
|
||||
@@ -467,7 +467,7 @@ macro_rules! select {
|
||||
let mut is_pending = false;
|
||||
|
||||
// Choose a starting index to begin polling the futures at. In
|
||||
// practice, this will either be a psuedo-randomly generrated
|
||||
// practice, this will either be a pseudo-randomly generated
|
||||
// number by default, or the constant 0 if `biased;` is
|
||||
// supplied.
|
||||
let start = $start;
|
||||
|
||||
@@ -30,7 +30,7 @@ pub struct ReadHalf<'a>(&'a TcpStream);
|
||||
|
||||
/// Borrowed write half of a [`TcpStream`], created by [`split`].
|
||||
///
|
||||
/// Note that in the [`AsyncWrite`] implemenation of this type, [`poll_shutdown`] will
|
||||
/// Note that in the [`AsyncWrite`] implementation of this type, [`poll_shutdown`] will
|
||||
/// shut down the TCP stream in the write direction.
|
||||
///
|
||||
/// Writing to an `WriteHalf` is usually done using the convenience methods found
|
||||
@@ -57,7 +57,7 @@ impl ReadHalf<'_> {
|
||||
/// `Waker` from the `Context` passed to the most recent call is scheduled
|
||||
/// to receive a wakeup.
|
||||
///
|
||||
/// See the [`TcpStream::poll_peek`] level documenation for more details.
|
||||
/// See the [`TcpStream::poll_peek`] level documentation for more details.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@@ -95,7 +95,7 @@ impl ReadHalf<'_> {
|
||||
/// connected, without removing that data from the queue. On success,
|
||||
/// returns the number of bytes peeked.
|
||||
///
|
||||
/// See the [`TcpStream::peek`] level documenation for more details.
|
||||
/// See the [`TcpStream::peek`] level documentation for more details.
|
||||
///
|
||||
/// [`TcpStream::peek`]: TcpStream::peek
|
||||
///
|
||||
|
||||
@@ -112,7 +112,7 @@ impl OwnedReadHalf {
|
||||
/// `Waker` from the `Context` passed to the most recent call is scheduled
|
||||
/// to receive a wakeup.
|
||||
///
|
||||
/// See the [`TcpStream::poll_peek`] level documenation for more details.
|
||||
/// See the [`TcpStream::poll_peek`] level documentation for more details.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@@ -150,7 +150,7 @@ impl OwnedReadHalf {
|
||||
/// connected, without removing that data from the queue. On success,
|
||||
/// returns the number of bytes peeked.
|
||||
///
|
||||
/// See the [`TcpStream::peek`] level documenation for more details.
|
||||
/// See the [`TcpStream::peek`] level documentation for more details.
|
||||
///
|
||||
/// [`TcpStream::peek`]: TcpStream::peek
|
||||
///
|
||||
|
||||
@@ -699,7 +699,7 @@ impl UdpSocket {
|
||||
/// [`connect`]: method@Self::connect
|
||||
pub fn poll_recv(&self, cx: &mut Context<'_>, buf: &mut ReadBuf<'_>) -> Poll<io::Result<()>> {
|
||||
let n = ready!(self.io.registration().poll_read_io(cx, || {
|
||||
// Safety: will not read the maybe uinitialized bytes.
|
||||
// Safety: will not read the maybe uninitialized bytes.
|
||||
let b = unsafe {
|
||||
&mut *(buf.unfilled_mut() as *mut [std::mem::MaybeUninit<u8>] as *mut [u8])
|
||||
};
|
||||
@@ -985,7 +985,7 @@ impl UdpSocket {
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// If successfull, returns the number of bytes sent
|
||||
/// If successful, returns the number of bytes sent
|
||||
///
|
||||
/// Users should ensure that when the remote cannot receive, the
|
||||
/// [`ErrorKind::WouldBlock`] is properly handled. An error can also occur
|
||||
@@ -1100,7 +1100,7 @@ impl UdpSocket {
|
||||
buf: &mut ReadBuf<'_>,
|
||||
) -> Poll<io::Result<SocketAddr>> {
|
||||
let (n, addr) = ready!(self.io.registration().poll_read_io(cx, || {
|
||||
// Safety: will not read the maybe uinitialized bytes.
|
||||
// Safety: will not read the maybe uninitialized bytes.
|
||||
let b = unsafe {
|
||||
&mut *(buf.unfilled_mut() as *mut [std::mem::MaybeUninit<u8>] as *mut [u8])
|
||||
};
|
||||
@@ -1239,7 +1239,7 @@ impl UdpSocket {
|
||||
buf: &mut ReadBuf<'_>,
|
||||
) -> Poll<io::Result<SocketAddr>> {
|
||||
let (n, addr) = ready!(self.io.registration().poll_read_io(cx, || {
|
||||
// Safety: will not read the maybe uinitialized bytes.
|
||||
// Safety: will not read the maybe uninitialized bytes.
|
||||
let b = unsafe {
|
||||
&mut *(buf.unfilled_mut() as *mut [std::mem::MaybeUninit<u8>] as *mut [u8])
|
||||
};
|
||||
|
||||
@@ -974,7 +974,7 @@ impl UnixDatagram {
|
||||
buf: &mut ReadBuf<'_>,
|
||||
) -> Poll<io::Result<SocketAddr>> {
|
||||
let (n, addr) = ready!(self.io.registration().poll_read_io(cx, || {
|
||||
// Safety: will not read the maybe uinitialized bytes.
|
||||
// Safety: will not read the maybe uninitialized bytes.
|
||||
let b = unsafe {
|
||||
&mut *(buf.unfilled_mut() as *mut [std::mem::MaybeUninit<u8>] as *mut [u8])
|
||||
};
|
||||
@@ -1075,7 +1075,7 @@ impl UnixDatagram {
|
||||
/// [`connect`]: method@Self::connect
|
||||
pub fn poll_recv(&self, cx: &mut Context<'_>, buf: &mut ReadBuf<'_>) -> Poll<io::Result<()>> {
|
||||
let n = ready!(self.io.registration().poll_read_io(cx, || {
|
||||
// Safety: will not read the maybe uinitialized bytes.
|
||||
// Safety: will not read the maybe uninitialized bytes.
|
||||
let b = unsafe {
|
||||
&mut *(buf.unfilled_mut() as *mut [std::mem::MaybeUninit<u8>] as *mut [u8])
|
||||
};
|
||||
|
||||
@@ -29,7 +29,7 @@ pub struct ReadHalf<'a>(&'a UnixStream);
|
||||
|
||||
/// Borrowed write half of a [`UnixStream`], created by [`split`].
|
||||
///
|
||||
/// Note that in the [`AsyncWrite`] implemenation of this type, [`poll_shutdown`] will
|
||||
/// Note that in the [`AsyncWrite`] implementation of this type, [`poll_shutdown`] will
|
||||
/// shut down the UnixStream stream in the write direction.
|
||||
///
|
||||
/// Writing to an `WriteHalf` is usually done using the convenience methods found
|
||||
|
||||
@@ -25,7 +25,7 @@ impl UCred {
|
||||
/// Gets PID (process ID) of the process.
|
||||
///
|
||||
/// This is only implemented under Linux, Android, iOS, macOS, Solaris and
|
||||
/// Illumos. On other plaforms this will always return `None`.
|
||||
/// Illumos. On other platforms this will always return `None`.
|
||||
pub fn pid(&self) -> Option<pid_t> {
|
||||
self.pid
|
||||
}
|
||||
|
||||
@@ -413,7 +413,7 @@ impl Builder {
|
||||
/// Sets a custom timeout for a thread in the blocking pool.
|
||||
///
|
||||
/// By default, the timeout for a thread is set to 10 seconds. This can
|
||||
/// be overriden using .thread_keep_alive().
|
||||
/// be overridden using .thread_keep_alive().
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
|
||||
@@ -64,7 +64,7 @@ cfg_rt! {
|
||||
// # Warning
|
||||
//
|
||||
// This is hidden for a reason. Do not use without fully understanding
|
||||
// executors. Misuing can easily cause your program to deadlock.
|
||||
// executors. Misusing can easily cause your program to deadlock.
|
||||
cfg_rt_multi_thread! {
|
||||
pub(crate) fn exit<F: FnOnce() -> R, R>(f: F) -> R {
|
||||
// Reset in case the closure panics
|
||||
|
||||
@@ -127,7 +127,7 @@ impl<T> Local<T> {
|
||||
// Concurrently stealing, this will free up capacity, so only
|
||||
// push the new task onto the inject queue
|
||||
//
|
||||
// If the task failes to be pushed on the injection queue, there
|
||||
// If the task fails to be pushed on the injection queue, there
|
||||
// is nothing to be done at this point as the task cannot be a
|
||||
// newly spawned task. Shutting down this task is handled by the
|
||||
// worker shutdown process.
|
||||
|
||||
@@ -131,7 +131,7 @@ impl<S: Schedule> Scheduler<S> {
|
||||
|
||||
/// Bind a scheduler to the task.
|
||||
///
|
||||
/// This only happens on the first poll and must be preceeded by a call to
|
||||
/// This only happens on the first poll and must be preceded by a call to
|
||||
/// `is_bound` to determine if binding is appropriate or not.
|
||||
///
|
||||
/// # Safety
|
||||
@@ -220,7 +220,7 @@ impl<T: Future> CoreStage<T> {
|
||||
/// # Safety
|
||||
///
|
||||
/// The caller must ensure it is safe to mutate the `state` field. This
|
||||
/// requires ensuring mutal exclusion between any concurrent thread that
|
||||
/// requires ensuring mutual exclusion between any concurrent thread that
|
||||
/// might modify the future or output field.
|
||||
///
|
||||
/// The mutual exclusion is implemented by `Harness` and the `Lifecycle`
|
||||
@@ -284,7 +284,7 @@ impl<T: Future> CoreStage<T> {
|
||||
use std::mem;
|
||||
|
||||
self.stage.with_mut(|ptr| {
|
||||
// Safety:: the caller ensures mutal exclusion to the field.
|
||||
// Safety:: the caller ensures mutual exclusion to the field.
|
||||
match mem::replace(unsafe { &mut *ptr }, Stage::Consumed) {
|
||||
Stage::Finished(output) => output,
|
||||
_ => panic!("JoinHandle polled after completion"),
|
||||
|
||||
@@ -163,7 +163,7 @@ where
|
||||
return;
|
||||
}
|
||||
|
||||
// By transitioning the lifcycle to `Running`, we have permission to
|
||||
// By transitioning the lifecycle to `Running`, we have permission to
|
||||
// drop the future.
|
||||
let err = cancel_task(&self.core().stage);
|
||||
self.complete(Err(err), true)
|
||||
|
||||
@@ -42,11 +42,11 @@ impl Idle {
|
||||
/// worker currently sleeping.
|
||||
pub(super) fn worker_to_notify(&self) -> Option<usize> {
|
||||
// If at least one worker is spinning, work being notified will
|
||||
// eventully be found. A searching thread will find **some** work and
|
||||
// eventually be found. A searching thread will find **some** work and
|
||||
// notify another worker, eventually leading to our work being found.
|
||||
//
|
||||
// For this to happen, this load must happen before the thread
|
||||
// transitioning `num_searching` to zero. Acquire / Relese does not
|
||||
// transitioning `num_searching` to zero. Acquire / Release does not
|
||||
// provide sufficient guarantees, so this load is done with `SeqCst` and
|
||||
// will pair with the `fetch_sub(1)` when transitioning out of
|
||||
// searching.
|
||||
|
||||
@@ -47,7 +47,7 @@ impl Driver {
|
||||
use std::mem::ManuallyDrop;
|
||||
use std::os::unix::io::{AsRawFd, FromRawFd};
|
||||
|
||||
// NB: We give each driver a "fresh" reciever file descriptor to avoid
|
||||
// NB: We give each driver a "fresh" receiver file descriptor to avoid
|
||||
// the issues described in alexcrichton/tokio-process#42.
|
||||
//
|
||||
// In the past we would reuse the actual receiver file descriptor and
|
||||
|
||||
@@ -229,7 +229,7 @@ impl<T> OnceCell<T> {
|
||||
} else {
|
||||
// After acquire().await we have either acquired a permit while self.value
|
||||
// is still uninitialized, or the current thread is awoken after another thread
|
||||
// has intialized the value and closed the semaphore, in which case self.initialized
|
||||
// has initialized the value and closed the semaphore, in which case self.initialized
|
||||
// is true and we don't set the value here
|
||||
match self.semaphore.acquire().await {
|
||||
Ok(_permit) => {
|
||||
@@ -285,7 +285,7 @@ impl<T> OnceCell<T> {
|
||||
} else {
|
||||
// After acquire().await we have either acquired a permit while self.value
|
||||
// is still uninitialized, or the current thread is awoken after another thread
|
||||
// has intialized the value and closed the semaphore, in which case self.initialized
|
||||
// has initialized the value and closed the semaphore, in which case self.initialized
|
||||
// is true and we don't set the value here
|
||||
match self.semaphore.acquire().await {
|
||||
Ok(_permit) => {
|
||||
@@ -370,7 +370,7 @@ pub enum SetError<T> {
|
||||
AlreadyInitializedError(T),
|
||||
|
||||
/// Error resulting from [`OnceCell::set`] calls when the cell is currently being
|
||||
/// inintialized during the calls to that method.
|
||||
/// initialized during the calls to that method.
|
||||
///
|
||||
/// [`OnceCell::set`]: crate::sync::OnceCell::set
|
||||
InitializingError(T),
|
||||
|
||||
@@ -42,7 +42,7 @@ where
|
||||
{
|
||||
// We run the test twice, with streams passed to copy_bidirectional in
|
||||
// different orders, in order to ensure that the two arguments are
|
||||
// interchangable.
|
||||
// interchangeable.
|
||||
|
||||
let (a, mut a1) = make_socketpair().await;
|
||||
let (b, mut b1) = make_socketpair().await;
|
||||
|
||||
@@ -50,8 +50,8 @@ fn read_exclusive_pending() {
|
||||
assert_pending!(t2.poll());
|
||||
}
|
||||
|
||||
// If the max shared access is reached and subsquent shared access is pending
|
||||
// should be made available when one of the shared acesses is dropped
|
||||
// If the max shared access is reached and subsequent shared access is pending
|
||||
// should be made available when one of the shared accesses is dropped
|
||||
#[test]
|
||||
fn exhaust_reading() {
|
||||
let rwlock = RwLock::with_max_readers(100, 1024);
|
||||
|
||||
@@ -82,7 +82,7 @@ fn test_abort_without_panic_3662() {
|
||||
// `Inner::block_on` of `basic_scheduler.rs`.
|
||||
//
|
||||
// We cause the cleanup to happen by having a poll return Pending once
|
||||
// so that the scheduler can go into the "auxilliary tasks" mode, at
|
||||
// so that the scheduler can go into the "auxiliary tasks" mode, at
|
||||
// which point the task is removed from the scheduler.
|
||||
let i = tokio::spawn(async move {
|
||||
tokio::task::yield_now().await;
|
||||
|
||||
@@ -334,7 +334,7 @@ fn with_timeout(timeout: Duration, f: impl FnOnce() + Send + 'static) {
|
||||
// something we can easily make assertions about, we'll run it in a
|
||||
// thread. When the test thread finishes, it will send a message on a
|
||||
// channel to this thread. We'll wait for that message with a fairly
|
||||
// generous timeout, and if we don't recieve it, we assume the test
|
||||
// generous timeout, and if we don't receive it, we assume the test
|
||||
// thread has hung.
|
||||
//
|
||||
// Note that it should definitely complete in under a minute, but just
|
||||
|
||||
@@ -349,7 +349,7 @@ async fn drop_from_wake() {
|
||||
|
||||
assert!(
|
||||
!panicked.load(Ordering::SeqCst),
|
||||
"paniced when dropping timers"
|
||||
"panicked when dropping timers"
|
||||
);
|
||||
|
||||
#[derive(Clone)]
|
||||
|
||||
Reference in New Issue
Block a user