JoinHandle's generic type

Why JoinHandle requires generic type? And that type, from what I understand is a return type of a closure passed to std: : thread : :spawn. Why would JoinHandle care what the return type of closure is? Unless I'm wrong (quite possibly).
Could somebody please explain that to me?
Thank you.

1 Like

When you call JoinHandle::join(), it waits for the child thread to end and then returns its closure’s return value. This requires the return type to be a generic parameter of JoinHandle.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.