thread-id:在Rust中获得唯一的线程ID

时间:2021-05-18 05:37:25
【文件属性】:
文件名称:thread-id:在Rust中获得唯一的线程ID
文件大小:10KB
文件格式:ZIP
更新时间:2021-05-18 05:37:25
Rust 线程ID 获取Rust中当前线程的唯一ID。 对于诊断和调试,获取每个线程不同的ID通常很有用。 ,标准库还没有公开执行此操作的方法,因此没有这种方法。 例子 use std :: thread; use thread_id; let handle = thread :: spawn ( move || { println! ( "spawned thread has id {}" , thread_id :: get ()); }); println! ( "main thread has id {}" , thread_id :: get ()); handle. join (). unwrap (); 这将打印两个不同的数字。 执照 您可以选择根据或对Thread-ID进行许可。 它可以在免费软件以及闭源应用程序中使用,可以在许可证规定的条件下用于商业和非商业用途。
【文件预览】:
thread-id-master
----.travis.yml(239B)
----license-mit(1KB)
----changelog.md(1KB)
----readme.md(2KB)
----Cargo.lock(2KB)
----src()
--------lib.rs(2KB)
----Cargo.toml(707B)
----.appveyor.yml(1KB)
----.gitignore(50B)
----license-apache(11KB)

网友评论