Movatterモバイル変換


[0]ホーム

URL:


current

std::thread

Functioncurrent 

1.0.0 ·Source
pub fn current() ->Thread
Expand description

Gets a handle to the thread that invokes it.

§Examples

Getting a handle to the current thread withthread::current():

usestd::thread;lethandler = thread::Builder::new()    .name("named thread".into())    .spawn(|| {lethandle = thread::current();assert_eq!(handle.name(),Some("named thread"));    })    .unwrap();handler.join().unwrap();

[8]ページ先頭

©2009-2026 Movatter.jp