id stringlengths 22 133 | text stringlengths 40 40.2k | arch stringclasses 1
value | syntax stringclasses 1
value | kind stringclasses 4
values | repo stringclasses 27
values | path stringlengths 5 116 | license stringclasses 6
values | commit stringlengths 40 40 | source_host stringclasses 1
value | category stringclasses 16
values | source_url stringlengths 85 196 | line_start int64 1 4.28k | line_end int64 4 4.31k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tokio-rs/tokio:tokio/src/sync/rwlock.rs:25 | ///
/// # Examples
///
/// ```
/// use tokio::sync::RwLock;
///
/// # #[tokio::main(flavor = "current_thread")]
/// # async fn main() {
/// let rw = RwLock::new(1);
///
/// let v = rw.read().await;
/// assert_eq!(*v, 1);
///
/// assert!(rw.try_write().is_err());
/... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | e65040f061008ca5a94d21721aa8b544c078c606 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e65040f061008ca5a94d21721aa8b544c078c606/tokio/src/sync/rwlock.rs | 961 | 1,020 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:26 | Ok(guard)
}
/// Attempts to acquire this `RwLock` with exclusive write access.
///
/// If the access couldn't be acquired immediately, returns [`TryLockError`].
/// Otherwise, an RAII guard is returned which will release write access
/// when dropped.
///
/// This method is identical to... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | e65040f061008ca5a94d21721aa8b544c078c606 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e65040f061008ca5a94d21721aa8b544c078c606/tokio/src/sync/rwlock.rs | 1,001 | 1,060 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:27 | let guard = OwnedRwLockWriteGuard {
#[cfg(all(tokio_unstable, feature = "tracing"))]
resource_span: self.resource_span.clone(),
permits_acquired: self.mr,
data: self.c.get(),
lock: self,
_p: PhantomData,
};
#[cfg(all(tokio_unstable... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | e65040f061008ca5a94d21721aa8b544c078c606 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e65040f061008ca5a94d21721aa8b544c078c606/tokio/src/sync/rwlock.rs | 1,041 | 1,100 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:28 | self.c.get_mut()
}
/// Consumes the lock, returning the underlying data.
pub fn into_inner(self) -> T
where
T: Sized,
{
self.c.into_inner()
}
}
impl<T> From<T> for RwLock<T> {
fn from(s: T) -> Self {
Self::new(s)
}
}
impl<T> Default for RwLock<T>
where
T: D... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | e65040f061008ca5a94d21721aa8b544c078c606 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e65040f061008ca5a94d21721aa8b544c078c606/tokio/src/sync/rwlock.rs | 1,081 | 1,120 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:7 | #[cfg(all(tokio_unstable, feature = "tracing"))]
let s = resource_span.in_scope(|| Semaphore::new(MAX_READS as usize));
#[cfg(any(not(tokio_unstable), not(feature = "tracing")))]
let s = Semaphore::new(MAX_READS as usize);
RwLock {
mr: MAX_READS,
c: UnsafeCell::... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/sync/rwlock.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:9 | mr: max_reads,
c: UnsafeCell::new(value),
s,
#[cfg(all(tokio_unstable, feature = "tracing"))]
resource_span,
}
}
/// Creates a new instance of an `RwLock<T>` which is unlocked.
///
/// When using the `tracing` [unstable feature], a `RwLock` create... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/sync/rwlock.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:10 | /// and allows a maximum of `max_reads` concurrent readers.
///
/// # Examples
///
/// ```
/// use tokio::sync::RwLock;
///
/// static LOCK: RwLock<i32> = RwLock::const_with_max_readers(5, 1024);
/// ```
#[cfg(not(all(loom, test)))]
pub const fn const_with_max_readers(value: T, m... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/sync/rwlock.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:11 | /// # Cancel safety
///
/// This method uses a queue to fairly distribute locks in the order they
/// were requested. Cancelling a call to `read` makes you lose your place in
/// the queue.
///
/// # Examples
///
/// ```
/// use std::sync::Arc;
/// use tokio::sync::RwLock;
//... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/sync/rwlock.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:12 | data: self.c.get(),
marker: PhantomData,
#[cfg(all(tokio_unstable, feature = "tracing"))]
resource_span: self.resource_span.clone(),
}
};
#[cfg(all(tokio_unstable, feature = "tracing"))]
let acquire_fut = trace::async_op(
m... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/sync/rwlock.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:15 | /// # #[tokio::main(flavor = "current_thread")]
/// # async fn main() {
/// let lock = Arc::new(RwLock::new(1));
/// let c_lock = lock.clone();
///
/// let n = lock.read_owned().await;
/// assert_eq!(*n, 1);
///
/// tokio::spawn(async move {
/// // While main has an active read l... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/sync/rwlock.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:16 | move || acquire_fut,
resource_span,
"RwLock::read_owned",
"poll",
false,
);
#[allow(clippy::let_and_return)] // this lint triggers when disabling tracing
let guard = acquire_fut.await;
#[cfg(all(tokio_unstable, feature = "tracing"))]
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/sync/rwlock.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:17 | ///
/// let v = lock.try_read().unwrap();
/// assert_eq!(*v, 1);
///
/// tokio::spawn(async move {
/// // While main has an active read lock, we acquire one too.
/// let n = c_lock.read().await;
/// assert_eq!(*n, 1);
/// }).await.expect("The spawned task has panicked");
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/sync/rwlock.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:18 | /// Attempts to acquire this `RwLock` with shared read access.
///
/// If the access couldn't be acquired immediately, returns [`TryLockError`].
/// Otherwise, an RAII guard is returned which will release read access
/// when dropped.
///
/// This method is identical to [`RwLock::try_read`], exc... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/sync/rwlock.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:19 | match self.s.try_acquire(1) {
Ok(permit) => permit,
Err(TryAcquireError::NoPermits) => return Err(TryLockError(())),
Err(TryAcquireError::Closed) => unreachable!(),
}
let guard = OwnedRwLockReadGuard {
#[cfg(all(tokio_unstable, feature = "tracing"))]
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/sync/rwlock.rs | 721 | 780 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:20 | ///
/// # Examples
///
/// ```
/// use tokio::sync::RwLock;
///
/// # #[tokio::main(flavor = "current_thread")]
/// # async fn main() {
/// let lock = RwLock::new(1);
///
/// let mut n = lock.write().await;
/// *n = 2;
/// # }
/// ```
pub async fn write(&self) -> ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/sync/rwlock.rs | 761 | 820 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:23 | /// This method is identical to [`RwLock::write`], except that the returned
/// guard references the `RwLock` with an [`Arc`] rather than by borrowing
/// it. Therefore, the `RwLock` must be wrapped in an `Arc` to call this
/// method, and the guard will live for the `'static` lifetime, as it keeps
/// ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/sync/rwlock.rs | 881 | 940 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:24 | OwnedRwLockWriteGuard {
#[cfg(all(tokio_unstable, feature = "tracing"))]
resource_span: self.resource_span.clone(),
permits_acquired: self.mr,
data: self.c.get(),
lock: self,
_p: PhantomData,
}
};
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/sync/rwlock.rs | 921 | 980 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:25 | /// [`TryLockError`]: TryLockError
///
/// # Examples
///
/// ```
/// use tokio::sync::RwLock;
///
/// # #[tokio::main(flavor = "current_thread")]
/// # async fn main() {
/// let rw = RwLock::new(1);
///
/// let v = rw.read().await;
/// assert_eq!(*v, 1);
///
/// ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/sync/rwlock.rs | 961 | 1,020 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:26 | });
Ok(guard)
}
/// Attempts to acquire this `RwLock` with exclusive write access.
///
/// If the access couldn't be acquired immediately, returns [`TryLockError`].
/// Otherwise, an RAII guard is returned which will release write access
/// when dropped.
///
/// This method is... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/sync/rwlock.rs | 1,001 | 1,060 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:27 | }
let guard = OwnedRwLockWriteGuard {
#[cfg(all(tokio_unstable, feature = "tracing"))]
resource_span: self.resource_span.clone(),
permits_acquired: self.mr,
data: self.c.get(),
lock: self,
_p: PhantomData,
};
#[cfg(all(tok... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/sync/rwlock.rs | 1,041 | 1,100 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:28 | pub fn get_mut(&mut self) -> &mut T {
self.c.get_mut()
}
/// Consumes the lock, returning the underlying data.
pub fn into_inner(self) -> T
where
T: Sized,
{
self.c.into_inner()
}
}
impl<T> From<T> for RwLock<T> {
fn from(s: T) -> Self {
Self::new(s)
}
}... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8ccf2fb92e7568bf16318dc8f3205cad14a9bc5d/tokio/src/sync/rwlock.rs | 1,081 | 1,121 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:10 | /// and allows a maximum of `max_reads` concurrent readers.
///
/// # Examples
///
/// ```
/// use tokio::sync::RwLock;
///
/// static LOCK: RwLock<i32> = RwLock::const_with_max_readers(5, 1024);
/// ```
#[cfg(not(all(loom, test)))]
pub const fn const_with_max_readers(value: T, m... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7/tokio/src/sync/rwlock.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:11 | /// # Cancel safety
///
/// This method uses a queue to fairly distribute locks in the order they
/// were requested. Cancelling a call to `read` makes you lose your place in
/// the queue.
///
/// # Examples
///
/// ```
/// use std::sync::Arc;
/// use tokio::sync::RwLock;
//... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7/tokio/src/sync/rwlock.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:12 | data: self.c.get(),
marker: PhantomData,
#[cfg(all(tokio_unstable, feature = "tracing"))]
resource_span: self.resource_span.clone(),
}
};
#[cfg(all(tokio_unstable, feature = "tracing"))]
let acquire_fut = trace::async_op(
m... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7/tokio/src/sync/rwlock.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:15 | /// let c_lock = lock.clone();
///
/// let n = lock.read_owned().await;
/// assert_eq!(*n, 1);
///
/// tokio::spawn(async move {
/// // While main has an active read lock, we acquire one too.
/// let r = c_lock.read_owned().await;
/// assert_eq!(*r... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7/tokio/src/sync/rwlock.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:16 | "poll",
false,
);
#[allow(clippy::let_and_return)] // this lint triggers when disabling tracing
let guard = acquire_fut.await;
#[cfg(all(tokio_unstable, feature = "tracing"))]
guard.resource_span.in_scope(|| {
tracing::trace!(
target: "runtim... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7/tokio/src/sync/rwlock.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:17 | ///
/// tokio::spawn(async move {
/// // While main has an active read lock, we acquire one too.
/// let n = c_lock.read().await;
/// assert_eq!(*n, 1);
/// }).await.expect("The spawned task has panicked");
///
/// // Drop the guard when spawned task finis... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7/tokio/src/sync/rwlock.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:18 | /// If the access couldn't be acquired immediately, returns [`TryLockError`].
/// Otherwise, an RAII guard is returned which will release read access
/// when dropped.
///
/// This method is identical to [`RwLock::try_read`], except that the
/// returned guard references the `RwLock` with an [`Arc`]... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7/tokio/src/sync/rwlock.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:19 | Err(TryAcquireError::Closed) => unreachable!(),
}
let guard = OwnedRwLockReadGuard {
#[cfg(all(tokio_unstable, feature = "tracing"))]
resource_span: self.resource_span.clone(),
data: self.c.get(),
lock: self,
_p: PhantomData,
};
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7/tokio/src/sync/rwlock.rs | 721 | 780 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:20 | /// ```
/// use tokio::sync::RwLock;
///
/// #[tokio::main]
/// async fn main() {
/// let lock = RwLock::new(1);
///
/// let mut n = lock.write().await;
/// *n = 2;
///}
/// ```
pub async fn write(&self) -> RwLockWriteGuard<'_, T> {
let acquire_fut = async {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7/tokio/src/sync/rwlock.rs | 761 | 820 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:23 | /// Returns an RAII guard which will drop the write access of this `RwLock`
/// when dropped.
///
/// # Cancel safety
///
/// This method uses a queue to fairly distribute locks in the order they
/// were requested. Cancelling a call to `write_owned` makes you lose your
/// place in the queu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7/tokio/src/sync/rwlock.rs | 881 | 940 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:24 | _p: PhantomData,
}
};
#[cfg(all(tokio_unstable, feature = "tracing"))]
let acquire_fut = trace::async_op(
move || acquire_fut,
resource_span,
"RwLock::write_owned",
"poll",
false,
);
#[allow(clippy::let_and... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7/tokio/src/sync/rwlock.rs | 921 | 980 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:25 | ///
/// #[tokio::main]
/// async fn main() {
/// let rw = RwLock::new(1);
///
/// let v = rw.read().await;
/// assert_eq!(*v, 1);
///
/// assert!(rw.try_write().is_err());
/// }
/// ```
pub fn try_write(&self) -> Result<RwLockWriteGuard<'_, T>, TryLockError> {... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7/tokio/src/sync/rwlock.rs | 961 | 1,020 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:26 | ///
/// If the access couldn't be acquired immediately, returns [`TryLockError`].
/// Otherwise, an RAII guard is returned which will release write access
/// when dropped.
///
/// This method is identical to [`RwLock::try_write`], except that the
/// returned guard references the `RwLock` with ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7/tokio/src/sync/rwlock.rs | 1,001 | 1,060 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:27 | data: self.c.get(),
lock: self,
_p: PhantomData,
};
#[cfg(all(tokio_unstable, feature = "tracing"))]
guard.resource_span.in_scope(|| {
tracing::trace!(
target: "runtime::resource::state_update",
write_locked = true,
write_l... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7/tokio/src/sync/rwlock.rs | 1,041 | 1,100 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:28 | where
T: Sized,
{
self.c.into_inner()
}
}
impl<T> From<T> for RwLock<T> {
fn from(s: T) -> Self {
Self::new(s)
}
}
impl<T> Default for RwLock<T>
where
T: Default,
{
fn default() -> Self {
Self::new(T::default())
}
}
impl<T: ?Sized> std::fmt::Debug for RwLoc... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a99a3518020e1c7ea6db6f9d2e7e567637a3d7e7/tokio/src/sync/rwlock.rs | 1,081 | 1,115 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:27 | data: self.c.get(),
lock: self,
_p: PhantomData,
};
#[cfg(all(tokio_unstable, feature = "tracing"))]
guard.resource_span.in_scope(|| {
tracing::trace!(
target: "runtime::resource::state_update",
write_locked = true,
write_l... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | a7896d07f1d3093524c7a190b57570dad3767c7a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a7896d07f1d3093524c7a190b57570dad3767c7a/tokio/src/sync/rwlock.rs | 1,041 | 1,100 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:28 | /// Consumes the lock, returning the underlying data.
pub fn into_inner(self) -> T
where
T: Sized,
{
self.c.into_inner()
}
}
impl<T> From<T> for RwLock<T> {
fn from(s: T) -> Self {
Self::new(s)
}
}
impl<T> Default for RwLock<T>
where
T: Default,
{
fn default() -... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | a7896d07f1d3093524c7a190b57570dad3767c7a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a7896d07f1d3093524c7a190b57570dad3767c7a/tokio/src/sync/rwlock.rs | 1,081 | 1,118 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:27 | data: self.c.get(),
lock: self,
_p: PhantomData,
};
#[cfg(all(tokio_unstable, feature = "tracing"))]
guard.resource_span.in_scope(|| {
tracing::trace!(
target: "runtime::resource::state_update",
write_locked = true,
write_l... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | d4178cf34924d14fca4ecf551c97b8953376f25a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/src/sync/rwlock.rs | 1,041 | 1,100 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:28 | /// Consumes the lock, returning the underlying data.
pub fn into_inner(self) -> T
where
T: Sized,
{
self.c.into_inner()
}
}
impl<T> From<T> for RwLock<T> {
fn from(s: T) -> Self {
Self::new(s)
}
}
impl<T: ?Sized> Default for RwLock<T>
where
T: Default,
{
fn def... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | d4178cf34924d14fca4ecf551c97b8953376f25a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/src/sync/rwlock.rs | 1,081 | 1,118 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:7 | #[cfg(all(tokio_unstable, feature = "tracing"))]
let s = resource_span.in_scope(|| Semaphore::new(MAX_READS as usize));
#[cfg(any(not(tokio_unstable), not(feature = "tracing")))]
let s = Semaphore::new(MAX_READS as usize);
RwLock {
mr: MAX_READS,
c: UnsafeCell::... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | daa89017dad7cecb769d3145c4368ae491a4ac67 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/sync/rwlock.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:9 | RwLock {
mr: max_reads,
c: UnsafeCell::new(value),
s,
#[cfg(all(tokio_unstable, feature = "tracing"))]
resource_span,
}
}
/// Creates a new instance of an `RwLock<T>` which is unlocked.
///
/// When using the `tracing` [unstable featur... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | daa89017dad7cecb769d3145c4368ae491a4ac67 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/sync/rwlock.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:10 | /// Creates a new instance of an `RwLock<T>` which is unlocked
/// and allows a maximum of `max_reads` concurrent readers.
///
/// # Examples
///
/// ```
/// use tokio::sync::RwLock;
///
/// static LOCK: RwLock<i32> = RwLock::const_with_max_readers(5, 1024);
/// ```
#[cfg(not(all... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | daa89017dad7cecb769d3145c4368ae491a4ac67 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/sync/rwlock.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:11 | ///
/// # Cancel safety
///
/// This method uses a queue to fairly distribute locks in the order they
/// were requested. Cancelling a call to `read` makes you lose your place in
/// the queue.
///
/// # Examples
///
/// ```
/// use std::sync::Arc;
/// use tokio::sync::RwLock... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | daa89017dad7cecb769d3145c4368ae491a4ac67 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/sync/rwlock.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:12 | s: &self.s,
data: self.c.get(),
marker: PhantomData,
#[cfg(all(tokio_unstable, feature = "tracing"))]
resource_span: self.resource_span.clone(),
}
};
#[cfg(all(tokio_unstable, feature = "tracing"))]
let acquire_fut = tr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | daa89017dad7cecb769d3145c4368ae491a4ac67 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/sync/rwlock.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:15 | /// let lock = Arc::new(RwLock::new(1));
/// let c_lock = lock.clone();
///
/// let n = lock.read_owned().await;
/// assert_eq!(*n, 1);
///
/// tokio::spawn(async move {
/// // While main has an active read lock, we acquire one too.
/// let r = c_lock.... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | daa89017dad7cecb769d3145c4368ae491a4ac67 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/sync/rwlock.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:16 | "RwLock::read_owned",
"poll",
false,
);
#[allow(clippy::let_and_return)] // this lint triggers when disabling tracing
let guard = acquire_fut.await;
#[cfg(all(tokio_unstable, feature = "tracing"))]
guard.resource_span.in_scope(|| {
tracing::t... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | daa89017dad7cecb769d3145c4368ae491a4ac67 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/sync/rwlock.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:17 | /// assert_eq!(*v, 1);
///
/// tokio::spawn(async move {
/// // While main has an active read lock, we acquire one too.
/// let n = c_lock.read().await;
/// assert_eq!(*n, 1);
/// }).await.expect("The spawned task has panicked");
///
/// // Drop th... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | daa89017dad7cecb769d3145c4368ae491a4ac67 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/sync/rwlock.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:18 | ///
/// If the access couldn't be acquired immediately, returns [`TryLockError`].
/// Otherwise, an RAII guard is returned which will release read access
/// when dropped.
///
/// This method is identical to [`RwLock::try_read`], except that the
/// returned guard references the `RwLock` with an... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | daa89017dad7cecb769d3145c4368ae491a4ac67 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/sync/rwlock.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:19 | Err(TryAcquireError::NoPermits) => return Err(TryLockError(())),
Err(TryAcquireError::Closed) => unreachable!(),
}
let guard = OwnedRwLockReadGuard {
#[cfg(all(tokio_unstable, feature = "tracing"))]
resource_span: self.resource_span.clone(),
data: self.c.... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | daa89017dad7cecb769d3145c4368ae491a4ac67 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/sync/rwlock.rs | 721 | 780 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:20 | ///
/// ```
/// use tokio::sync::RwLock;
///
/// #[tokio::main]
/// async fn main() {
/// let lock = RwLock::new(1);
///
/// let mut n = lock.write().await;
/// *n = 2;
///}
/// ```
pub async fn write(&self) -> RwLockWriteGuard<'_, T> {
let acquire_fut = asy... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | daa89017dad7cecb769d3145c4368ae491a4ac67 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/sync/rwlock.rs | 761 | 820 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:23 | ///
/// Returns an RAII guard which will drop the write access of this `RwLock`
/// when dropped.
///
/// # Cancel safety
///
/// This method uses a queue to fairly distribute locks in the order they
/// were requested. Cancelling a call to `write_owned` makes you lose your
/// place in ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | daa89017dad7cecb769d3145c4368ae491a4ac67 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/sync/rwlock.rs | 881 | 940 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:24 | lock: self,
_p: PhantomData,
}
};
#[cfg(all(tokio_unstable, feature = "tracing"))]
let acquire_fut = trace::async_op(
move || acquire_fut,
resource_span,
"RwLock::write_owned",
"poll",
false,
);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | daa89017dad7cecb769d3145c4368ae491a4ac67 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/sync/rwlock.rs | 921 | 980 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:25 | /// use tokio::sync::RwLock;
///
/// #[tokio::main]
/// async fn main() {
/// let rw = RwLock::new(1);
///
/// let v = rw.read().await;
/// assert_eq!(*v, 1);
///
/// assert!(rw.try_write().is_err());
/// }
/// ```
pub fn try_write(&self) -> Result<RwLockW... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | daa89017dad7cecb769d3145c4368ae491a4ac67 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/sync/rwlock.rs | 961 | 1,020 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:26 | /// Attempts to acquire this `RwLock` with exclusive write access.
///
/// If the access couldn't be acquired immediately, returns [`TryLockError`].
/// Otherwise, an RAII guard is returned which will release write access
/// when dropped.
///
/// This method is identical to [`RwLock::try_write`... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | daa89017dad7cecb769d3145c4368ae491a4ac67 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/sync/rwlock.rs | 1,001 | 1,060 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:27 | permits_acquired: self.mr,
data: self.c.get(),
lock: self,
_p: PhantomData,
};
#[cfg(all(tokio_unstable, feature = "tracing"))]
guard.resource_span.in_scope(|| {
tracing::trace!(
target: "runtime::resource::state_update",
w... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | daa89017dad7cecb769d3145c4368ae491a4ac67 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/sync/rwlock.rs | 1,041 | 1,100 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:28 | }
/// Consumes the lock, returning the underlying data.
pub fn into_inner(self) -> T
where
T: Sized,
{
self.c.into_inner()
}
}
impl<T> From<T> for RwLock<T> {
fn from(s: T) -> Self {
Self::new(s)
}
}
impl<T: ?Sized> Default for RwLock<T>
where
T: Default,
{
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | daa89017dad7cecb769d3145c4368ae491a4ac67 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/src/sync/rwlock.rs | 1,081 | 1,119 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:1 | use crate::sync::batch_semaphore::{Semaphore, TryAcquireError};
use crate::sync::mutex::TryLockError;
#[cfg(all(tokio_unstable, feature = "tracing"))]
use crate::util::trace;
use std::cell::UnsafeCell;
use std::marker;
use std::marker::PhantomData;
use std::sync::Arc;
pub(crate) mod owned_read_guard;
pub(crate) mod ow... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 7c606ab44aa9f0c33dfcf5bc8678411dddeaa9e5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7c606ab44aa9f0c33dfcf5bc8678411dddeaa9e5/tokio/src/sync/rwlock.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:19 | Err(TryAcquireError::NoPermits) => return Err(TryLockError(())),
Err(TryAcquireError::Closed) => unreachable!(),
}
let guard = OwnedRwLockReadGuard {
#[cfg(all(tokio_unstable, feature = "tracing"))]
resource_span: self.resource_span.clone(),
data: self.c.... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 7b555185ff9186f618b198126ee853980b187698 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b555185ff9186f618b198126ee853980b187698/tokio/src/sync/rwlock.rs | 721 | 780 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:20 | ///
/// ```
/// use tokio::sync::RwLock;
///
/// #[tokio::main]
/// async fn main() {
/// let lock = RwLock::new(1);
///
/// let mut n = lock.write().await;
/// *n = 2;
///}
/// ```
pub async fn write(&self) -> RwLockWriteGuard<'_, T> {
let acquire_fut = asy... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 7b555185ff9186f618b198126ee853980b187698 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b555185ff9186f618b198126ee853980b187698/tokio/src/sync/rwlock.rs | 761 | 820 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:23 | ///
/// Returns an RAII guard which will drop the write access of this `RwLock`
/// when dropped.
///
/// # Cancel safety
///
/// This method uses a queue to fairly distribute locks in the order they
/// were requested. Cancelling a call to `write_owned` makes you lose your
/// place in ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 7b555185ff9186f618b198126ee853980b187698 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b555185ff9186f618b198126ee853980b187698/tokio/src/sync/rwlock.rs | 881 | 940 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:24 | lock: self,
_p: PhantomData,
}
};
#[cfg(all(tokio_unstable, feature = "tracing"))]
let acquire_fut = trace::async_op(
move || acquire_fut,
resource_span,
"RwLock::write_owned",
"poll",
false,
);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 7b555185ff9186f618b198126ee853980b187698 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b555185ff9186f618b198126ee853980b187698/tokio/src/sync/rwlock.rs | 921 | 980 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:25 | /// use tokio::sync::RwLock;
///
/// #[tokio::main]
/// async fn main() {
/// let rw = RwLock::new(1);
///
/// let v = rw.read().await;
/// assert_eq!(*v, 1);
///
/// assert!(rw.try_write().is_err());
/// }
/// ```
pub fn try_write(&self) -> Result<RwLockW... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 7b555185ff9186f618b198126ee853980b187698 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b555185ff9186f618b198126ee853980b187698/tokio/src/sync/rwlock.rs | 961 | 1,020 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:26 | /// Attempts to acquire this `RwLock` with exclusive write access.
///
/// If the access couldn't be acquired immediately, returns [`TryLockError`].
/// Otherwise, an RAII guard is returned which will release write access
/// when dropped.
///
/// This method is identical to [`RwLock::try_write`... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 7b555185ff9186f618b198126ee853980b187698 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b555185ff9186f618b198126ee853980b187698/tokio/src/sync/rwlock.rs | 1,001 | 1,060 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:5 | U: ?Sized + Sync,
{
}
unsafe impl<T, U> Sync for OwnedRwLockReadGuard<T, U>
where
T: ?Sized + Send + Sync,
U: ?Sized + Send + Sync,
{
}
unsafe impl<T> Sync for RwLockWriteGuard<'_, T> where T: ?Sized + Send + Sync {}
unsafe impl<T> Sync for OwnedRwLockWriteGuard<T> where T: ?Sized + Send + Sync {}
unsafe impl<T... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | d247e7f5df4bd861287467ecc5f827538bee4d63 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d247e7f5df4bd861287467ecc5f827538bee4d63/tokio/src/sync/rwlock.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:6 | /// let lock = RwLock::new(5);
/// ```
#[track_caller]
pub fn new(value: T) -> RwLock<T>
where
T: Sized,
{
#[cfg(all(tokio_unstable, feature = "tracing"))]
let resource_span = {
let location = std::panic::Location::caller();
let resource_span = tracing... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | d247e7f5df4bd861287467ecc5f827538bee4d63 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d247e7f5df4bd861287467ecc5f827538bee4d63/tokio/src/sync/rwlock.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:7 | let s = resource_span.in_scope(|| Semaphore::new(MAX_READS as usize));
#[cfg(any(not(tokio_unstable), not(feature = "tracing")))]
let s = Semaphore::new(MAX_READS as usize);
RwLock {
mr: MAX_READS,
c: UnsafeCell::new(value),
s,
#[cfg(all(tokio_un... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | d247e7f5df4bd861287467ecc5f827538bee4d63 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d247e7f5df4bd861287467ecc5f827538bee4d63/tokio/src/sync/rwlock.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:8 | let resource_span = {
let location = std::panic::Location::caller();
let resource_span = tracing::trace_span!(
"runtime.resource",
concrete_type = "RwLock",
kind = "Sync",
loc.file = location.file(),
loc.line = loca... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | d247e7f5df4bd861287467ecc5f827538bee4d63 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d247e7f5df4bd861287467ecc5f827538bee4d63/tokio/src/sync/rwlock.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:10 | ///
/// # Examples
///
/// ```
/// use tokio::sync::RwLock;
///
/// static LOCK: RwLock<i32> = RwLock::const_with_max_readers(5, 1024);
/// ```
#[cfg(not(all(loom, test)))]
pub const fn const_with_max_readers(value: T, max_reads: u32) -> RwLock<T>
where
T: Sized,
{
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | d247e7f5df4bd861287467ecc5f827538bee4d63 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d247e7f5df4bd861287467ecc5f827538bee4d63/tokio/src/sync/rwlock.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:11 | ///
/// This method uses a queue to fairly distribute locks in the order they
/// were requested. Cancelling a call to `read` makes you lose your place in
/// the queue.
///
/// # Examples
///
/// ```
/// use std::sync::Arc;
/// use tokio::sync::RwLock;
///
/// #[tokio::main]... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | d247e7f5df4bd861287467ecc5f827538bee4d63 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d247e7f5df4bd861287467ecc5f827538bee4d63/tokio/src/sync/rwlock.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:12 | marker: PhantomData,
#[cfg(all(tokio_unstable, feature = "tracing"))]
resource_span: self.resource_span.clone(),
}
};
#[cfg(all(tokio_unstable, feature = "tracing"))]
let acquire_fut = trace::async_op(
move || acquire_fut,
self... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | d247e7f5df4bd861287467ecc5f827538bee4d63 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d247e7f5df4bd861287467ecc5f827538bee4d63/tokio/src/sync/rwlock.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:15 | ///
/// let n = lock.read_owned().await;
/// assert_eq!(*n, 1);
///
/// tokio::spawn(async move {
/// // While main has an active read lock, we acquire one too.
/// let r = c_lock.read_owned().await;
/// assert_eq!(*r, 1);
/// }).await.expect("The ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | d247e7f5df4bd861287467ecc5f827538bee4d63 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d247e7f5df4bd861287467ecc5f827538bee4d63/tokio/src/sync/rwlock.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:16 | false,
);
#[allow(clippy::let_and_return)] // this lint triggers when disabling tracing
let guard = acquire_fut.await;
#[cfg(all(tokio_unstable, feature = "tracing"))]
guard.resource_span.in_scope(|| {
tracing::trace!(
target: "runtime::resource::state_u... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | d247e7f5df4bd861287467ecc5f827538bee4d63 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d247e7f5df4bd861287467ecc5f827538bee4d63/tokio/src/sync/rwlock.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:17 | /// tokio::spawn(async move {
/// // While main has an active read lock, we acquire one too.
/// let n = c_lock.read().await;
/// assert_eq!(*n, 1);
/// }).await.expect("The spawned task has panicked");
///
/// // Drop the guard when spawned task finishes.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | d247e7f5df4bd861287467ecc5f827538bee4d63 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d247e7f5df4bd861287467ecc5f827538bee4d63/tokio/src/sync/rwlock.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:18 | /// Otherwise, an RAII guard is returned which will release read access
/// when dropped.
///
/// This method is identical to [`RwLock::try_read`], except that the
/// returned guard references the `RwLock` with an [`Arc`] rather than by
/// borrowing it. Therefore, the `RwLock` must be wrapped in a... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | d247e7f5df4bd861287467ecc5f827538bee4d63 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d247e7f5df4bd861287467ecc5f827538bee4d63/tokio/src/sync/rwlock.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:19 | }
let guard = OwnedRwLockReadGuard {
#[cfg(all(tokio_unstable, feature = "tracing"))]
resource_span: self.resource_span.clone(),
data: self.c.get(),
lock: self,
_p: PhantomData,
};
#[cfg(all(tokio_unstable, feature = "tracing"))]
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | d247e7f5df4bd861287467ecc5f827538bee4d63 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d247e7f5df4bd861287467ecc5f827538bee4d63/tokio/src/sync/rwlock.rs | 721 | 780 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:20 | /// use tokio::sync::RwLock;
///
/// #[tokio::main]
/// async fn main() {
/// let lock = RwLock::new(1);
///
/// let mut n = lock.write().await;
/// *n = 2;
///}
/// ```
pub async fn write(&self) -> RwLockWriteGuard<'_, T> {
let acquire_fut = async {
sel... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | d247e7f5df4bd861287467ecc5f827538bee4d63 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d247e7f5df4bd861287467ecc5f827538bee4d63/tokio/src/sync/rwlock.rs | 761 | 820 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:23 | /// when dropped.
///
/// # Cancel safety
///
/// This method uses a queue to fairly distribute locks in the order they
/// were requested. Cancelling a call to `write_owned` makes you lose your
/// place in the queue.
///
/// # Examples
///
/// ```
/// use std::sync::Arc;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | d247e7f5df4bd861287467ecc5f827538bee4d63 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d247e7f5df4bd861287467ecc5f827538bee4d63/tokio/src/sync/rwlock.rs | 881 | 940 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:24 | }
};
#[cfg(all(tokio_unstable, feature = "tracing"))]
let acquire_fut = trace::async_op(
move || acquire_fut,
resource_span,
"RwLock::write_owned",
"poll",
false,
);
#[allow(clippy::let_and_return)] // this lint trigge... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | d247e7f5df4bd861287467ecc5f827538bee4d63 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d247e7f5df4bd861287467ecc5f827538bee4d63/tokio/src/sync/rwlock.rs | 921 | 980 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:25 | /// #[tokio::main]
/// async fn main() {
/// let rw = RwLock::new(1);
///
/// let v = rw.read().await;
/// assert_eq!(*v, 1);
///
/// assert!(rw.try_write().is_err());
/// }
/// ```
pub fn try_write(&self) -> Result<RwLockWriteGuard<'_, T>, TryLockError> {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | d247e7f5df4bd861287467ecc5f827538bee4d63 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d247e7f5df4bd861287467ecc5f827538bee4d63/tokio/src/sync/rwlock.rs | 961 | 1,020 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:26 | /// If the access couldn't be acquired immediately, returns [`TryLockError`].
/// Otherwise, an RAII guard is returned which will release write access
/// when dropped.
///
/// This method is identical to [`RwLock::try_write`], except that the
/// returned guard references the `RwLock` with an [`Arc... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | d247e7f5df4bd861287467ecc5f827538bee4d63 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d247e7f5df4bd861287467ecc5f827538bee4d63/tokio/src/sync/rwlock.rs | 1,001 | 1,060 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:27 | lock: self,
_p: PhantomData,
};
#[cfg(all(tokio_unstable, feature = "tracing"))]
guard.resource_span.in_scope(|| {
tracing::trace!(
target: "runtime::resource::state_update",
write_locked = true,
write_locked.op = "override",
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | d247e7f5df4bd861287467ecc5f827538bee4d63 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d247e7f5df4bd861287467ecc5f827538bee4d63/tokio/src/sync/rwlock.rs | 1,041 | 1,100 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:8 | let resource_span = {
let location = std::panic::Location::caller();
let resource_span = tracing::trace_span!(
"runtime.resource",
concrete_type = "RwLock",
kind = "Sync",
loc.file = location.file(),
loc.line = loca... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | efe3ab679a05f3da3fcc511a44120239830254f2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/src/sync/rwlock.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:9 | c: UnsafeCell::new(value),
s,
#[cfg(all(tokio_unstable, feature = "tracing"))]
resource_span,
}
}
/// Creates a new instance of an `RwLock<T>` which is unlocked.
///
/// # Examples
///
/// ```
/// use tokio::sync::RwLock;
///
/// static LO... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | efe3ab679a05f3da3fcc511a44120239830254f2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/src/sync/rwlock.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:10 | #[cfg(not(all(loom, test)))]
pub const fn const_with_max_readers(value: T, max_reads: u32) -> RwLock<T>
where
T: Sized,
{
assert!(max_reads <= MAX_READS);
RwLock {
mr: max_reads,
c: UnsafeCell::new(value),
s: Semaphore::const_new(max_reads as usiz... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | efe3ab679a05f3da3fcc511a44120239830254f2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/src/sync/rwlock.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:11 | /// use std::sync::Arc;
/// use tokio::sync::RwLock;
///
/// #[tokio::main]
/// async fn main() {
/// let lock = Arc::new(RwLock::new(1));
/// let c_lock = lock.clone();
///
/// let n = lock.read().await;
/// assert_eq!(*n, 1);
///
/// tokio::spawn(async m... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | efe3ab679a05f3da3fcc511a44120239830254f2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/src/sync/rwlock.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:12 | move || acquire_fut,
self.resource_span.clone(),
"RwLock::read",
"poll",
false,
);
#[allow(clippy::let_and_return)] // this lint triggers when disabling tracing
let guard = acquire_fut.await;
#[cfg(all(tokio_unstable, feature = "tracing")... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | efe3ab679a05f3da3fcc511a44120239830254f2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/src/sync/rwlock.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:15 | /// }).await.expect("The spawned task has panicked");
///
/// // Drop the guard after the spawned task finishes.
/// drop(n);
///}
/// ```
pub async fn read_owned(self: Arc<Self>) -> OwnedRwLockReadGuard<T> {
#[cfg(all(tokio_unstable, feature = "tracing"))]
let resour... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | efe3ab679a05f3da3fcc511a44120239830254f2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/src/sync/rwlock.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:16 | tracing::trace!(
target: "runtime::resource::state_update",
current_readers = 1,
current_readers.op = "add",
)
});
guard
}
/// Attempts to acquire this `RwLock` with shared read access.
///
/// If the access couldn't be acquired immediate... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | efe3ab679a05f3da3fcc511a44120239830254f2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/src/sync/rwlock.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:17 | /// }
/// ```
pub fn try_read(&self) -> Result<RwLockReadGuard<'_, T>, TryLockError> {
match self.s.try_acquire(1) {
Ok(permit) => permit,
Err(TryAcquireError::NoPermits) => return Err(TryLockError(())),
Err(TryAcquireError::Closed) => unreachable!(),
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | efe3ab679a05f3da3fcc511a44120239830254f2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/src/sync/rwlock.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:18 | ///
/// [`TryLockError`]: TryLockError
///
/// # Examples
///
/// ```
/// use std::sync::Arc;
/// use tokio::sync::RwLock;
///
/// #[tokio::main]
/// async fn main() {
/// let lock = Arc::new(RwLock::new(1));
/// let c_lock = lock.clone();
///
/// let ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | efe3ab679a05f3da3fcc511a44120239830254f2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/src/sync/rwlock.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:19 | };
#[cfg(all(tokio_unstable, feature = "tracing"))]
guard.resource_span.in_scope(|| {
tracing::trace!(
target: "runtime::resource::state_update",
current_readers = 1,
current_readers.op = "add",
)
});
Ok(guard)
}
/// ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | efe3ab679a05f3da3fcc511a44120239830254f2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/src/sync/rwlock.rs | 721 | 780 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:20 | ///}
/// ```
pub async fn write(&self) -> RwLockWriteGuard<'_, T> {
let acquire_fut = async {
self.s.acquire(self.mr).await.unwrap_or_else(|_| {
// The semaphore was closed. but, we never explicitly close it, and we have a
// handle to it through the Arc, whic... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | efe3ab679a05f3da3fcc511a44120239830254f2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/src/sync/rwlock.rs | 761 | 820 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:23 | /// # Examples
///
/// ```
/// use std::sync::Arc;
/// use tokio::sync::RwLock;
///
/// #[tokio::main]
/// async fn main() {
/// let lock = Arc::new(RwLock::new(1));
///
/// let mut n = lock.write_owned().await;
/// *n = 2;
///}
/// ```
pub async fn write_ow... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | efe3ab679a05f3da3fcc511a44120239830254f2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/src/sync/rwlock.rs | 881 | 940 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:24 | "poll",
false,
);
#[allow(clippy::let_and_return)] // this lint triggers when disabling tracing
let guard = acquire_fut.await;
#[cfg(all(tokio_unstable, feature = "tracing"))]
guard.resource_span.in_scope(|| {
tracing::trace!(
target: "runtim... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | efe3ab679a05f3da3fcc511a44120239830254f2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/src/sync/rwlock.rs | 921 | 980 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:25 | /// }
/// ```
pub fn try_write(&self) -> Result<RwLockWriteGuard<'_, T>, TryLockError> {
match self.s.try_acquire(self.mr) {
Ok(permit) => permit,
Err(TryAcquireError::NoPermits) => return Err(TryLockError(())),
Err(TryAcquireError::Closed) => unreachable!(),
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | efe3ab679a05f3da3fcc511a44120239830254f2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/src/sync/rwlock.rs | 961 | 1,020 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:26 | /// as it keeps the `RwLock` alive by holding an `Arc`.
///
/// [`TryLockError`]: TryLockError
///
/// # Examples
///
/// ```
/// use std::sync::Arc;
/// use tokio::sync::RwLock;
///
/// #[tokio::main]
/// async fn main() {
/// let rw = Arc::new(RwLock::new(1));
/... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | efe3ab679a05f3da3fcc511a44120239830254f2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/src/sync/rwlock.rs | 1,001 | 1,060 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:27 | write_locked = true,
write_locked.op = "override",
)
});
Ok(guard)
}
/// Returns a mutable reference to the underlying data.
///
/// Since this call borrows the `RwLock` mutably, no actual locking needs to
/// take place -- the mutable borrow statically guar... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | efe3ab679a05f3da3fcc511a44120239830254f2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/src/sync/rwlock.rs | 1,041 | 1,100 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:28 | impl<T> From<T> for RwLock<T> {
fn from(s: T) -> Self {
Self::new(s)
}
}
impl<T: ?Sized> Default for RwLock<T>
where
T: Default,
{
fn default() -> Self {
Self::new(T::default())
}
}
impl<T: ?Sized> std::fmt::Debug for RwLock<T>
where
T: std::fmt::Debug,
{
fn fmt(&self, f: &... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | efe3ab679a05f3da3fcc511a44120239830254f2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/src/sync/rwlock.rs | 1,081 | 1,109 |
tokio-rs/tokio:tokio/src/sync/rwlock.rs:8 | let resource_span = {
let location = std::panic::Location::caller();
let resource_span = tracing::trace_span!(
"runtime.resource",
concrete_type = "RwLock",
kind = "Sync",
loc.file = location.file(),
loc.line = loca... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/rwlock.rs | MIT | 11b88075440f1b141e4a18c7d506df0fc0eceb71 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/11b88075440f1b141e4a18c7d506df0fc0eceb71/tokio/src/sync/rwlock.rs | 281 | 340 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.