検索

phrase: max: clip:
target: order:
Results of 1 - 5 of about 5 for handle (0.017 sec.)
状態共有並行性 - Rust 日本語版 11766
The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello, ... ; fn main() { let counter = Mutex::new(0); let mut handles = vec![]; for _ in 0..10 { let handle = thread::s ... mut num = counter.lock().unwrap(); *num += 1; }); handles.push(handle); } for handle in handles { handle.jo ... ています: `counter`) --> src/main.rs:10:27 | 9 | let handle = thread::spawn(move || { | ------- value moved (i ... d value: `counter` --> src/main.rs:21:29 | 9 | let handle = thread::spawn(move || { | ------- value moved (i ...
https://man.plustar.jp/rust/book/ch16-03-shared-state.html - [similar]
スレッドを使用してコードを同時に走らせる - Rust 日本語版 10663
The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello, ... ることができます。 thread::spawn の戻り値の型は JoinHandle です。 JoinHandle は、その join メソッドを呼び出し ... 。 リスト16-2は、リスト16-1で生成したスレッドの JoinHandle を使用し、 join を呼び出して、 main が終了する前に ... ::thread; use std::time::Duration; fn main() { let handle = thread::spawn(|| { for i in 1..10 { println!("hi ... !", i); thread::sleep(Duration::from_millis(1)); } handle.join().unwrap(); } リスト16-2: thread::spawn の Jo ...
https://man.plustar.jp/rust/book/ch16-01-threads.html - [similar]
シングルスレッドのWebサーバを構築する - Rust 日本語版 9118
The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello, ... 、 接続を処理する新しい関数を開始します。この新しい handle_connection 関数において、TCPストリームからデータを ... istener.incoming() { let stream = stream.unwrap(); handle_connection(stream); } } fn handle_connection(mut s ... というメッセージを出力する代わりに、今では、 新しい handle_connection 関数を呼び出し、 stream を渡しています。 ... handle_connection 関数において、 stream 引数を可変にしまし ...
https://man.plustar.jp/rust/book/ch20-01-single-threaded.html - [similar]
シングルスレッドサーバをマルチスレッド化する - Rust 日本語版 7225
The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello, ... :net::TcpStream; use std::fs::File; // --snip-- fn handle_connection(mut stream: TcpStream) { let mut buffer ... { let stream = stream.unwrap(); thread::spawn(|| { handle_connection(stream); }); } } fn handle_connection(m ... { let stream = stream.unwrap(); pool.execute(|| { handle_connection(stream); }); } } fn handle_connection(m ... ものを示しています: pub fn spawn<F, T>(f: F) -> JoinHandle<T> where F: FnOnce() -> T + Send + 'static, T: Sen ...
https://man.plustar.jp/rust/book/ch20-02-multithreaded.html - [similar]
正常なシャットダウンと片付け - Rust 日本語版 7133
The Rust Programming Language 日本語版 まえがき はじめに 1. 事始め 1.1. インストール 1.2. Hello, ... では行いました: Worker が代わりに Option<thread::JoinHandle<()>> を保持していれば、 Option に対して take メソッ ... uct Worker { id: usize, thread: Option<thread::JoinHandle<()>>, } } さて、コンパイラを頼りにして他に変更する ... und for type `std::option::Option<std::thread::JoinHandle<()>>` in the current scope --> src/lib.rs:65:27 | ... d::option::Option`, found struct `std::thread::JoinHandle` | help: try using a variant of the expected type: ...
https://man.plustar.jp/rust/book/ch20-03-graceful-shutdown-and-cleanup.html - [similar]
PREV 1 NEXT