onelinerhub icon indicating copy to clipboard operation
onelinerhub copied to clipboard

"How to join a thread with a timeout in Rust?" is not valid Rust

Open Chasethechicken opened this issue 1 year ago • 0 comments

  1. A link to the code with a problem: https://onelinerhub.com/rust/how-to-join-a-thread-with-a-timeout-in-rust
  2. Short explanation of the problem in the solution The code explains, that join_timeout can be used to join a thread with a timeout. This is false, as can be seen in the linked docs: https://doc.rust-lang.org/std/thread/struct.Thread.html#method.join_timeout and additionally https://doc.rust-lang.org/std/thread/struct.JoinHandle.html A JoinHandle has no function join_timeout.
  3. Proposal of changes (if any): Remove the example. Alternatively implement something using is_finished instead, to check if the thread has finished.

Chasethechicken avatar Jan 13 '24 00:01 Chasethechicken