mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-05 18:20:34 +00:00
cros_async: name threads + doc fix
BUG=b:191488633 TEST=cargo test && cargo doc && cargo clippy Change-Id: I61cfb4b547e7ca280ad1726300fd145617a27d69 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3059870 Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Vikram Auradkar <auradkar@google.com> Auto-Submit: Vikram Auradkar <auradkar@google.com> Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
This commit is contained in:
parent
a27e035aa2
commit
ed4bd118bc
2 changed files with 8 additions and 3 deletions
|
@ -96,7 +96,12 @@ impl Inner {
|
|||
let entry = state.worker_threads.vacant_entry();
|
||||
let idx = entry.key();
|
||||
let inner = self.clone();
|
||||
entry.insert(thread::spawn(move || run_blocking_thread(idx, inner)));
|
||||
entry.insert(
|
||||
thread::Builder::new()
|
||||
.name(format!("blockingPool{}", idx))
|
||||
.spawn(move || run_blocking_thread(idx, inner))
|
||||
.unwrap(),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// We have idle threads, wake one up.
|
||||
|
|
|
@ -50,7 +50,7 @@ pub(crate) fn async_poll_from<'a, F: IntoAsync + Send + 'a>(
|
|||
/// // Write all bytes from `data` to `f`.
|
||||
/// async fn write_file(f: &dyn IoSourceExt<File>, mut data: Vec<u8>) -> AsyncResult<()> {
|
||||
/// while data.len() > 0 {
|
||||
/// let (count, mut buf) = f.write_from_vec(0, data).await?;
|
||||
/// let (count, mut buf) = f.write_from_vec(None, data).await?;
|
||||
///
|
||||
/// data = buf.split_off(count);
|
||||
/// }
|
||||
|
@ -68,7 +68,7 @@ pub(crate) fn async_poll_from<'a, F: IntoAsync + Send + 'a>(
|
|||
///
|
||||
/// while rem > 0 {
|
||||
/// let buf = vec![0u8; min(rem, CHUNK_SIZE)];
|
||||
/// let (count, mut data) = from.read_to_vec(0, buf).await?;
|
||||
/// let (count, mut data) = from.read_to_vec(None, buf).await?;
|
||||
///
|
||||
/// if count == 0 {
|
||||
/// // End of file. Return the number of bytes transferred.
|
||||
|
|
Loading…
Reference in a new issue