-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
This slide says that threads are all daemon threads, but this is untrue:
- For one, you're only talking about
thread::spawncreated threads, as per the very next slide - For two, these threads are only detached if you drop the
JoinHandle - You also mention panicking and payloads, but you can only catch unwind payloads on the current thread; for panics of another
spawned thread, you calljoinon the join handle to see if it panicked and to get the payload- I.e. you can only do this if the thread isn't detached
So you should talk about JoinHandle and detaching via Drop.
On the scoped page you should talk about the different behavior:
ScopedJoinHandlejoins and blocks uponDropinstead of detaching- Any dropped
ScopeJoinHandlethat witnesses a thread panic will causethread::scopeto panic - But you can manually
joinand check for thread panics instead, similar toJoinHandle
Aside from the ability to borrow, this difference in handle drop behavior (and thus what may panic where) is the main difference between the two tools.
Metadata
Metadata
Assignees
Labels
No labels