I know that you can get the current thread using thread::current()
, but that gives me a Thread
which I cannot use from another thread to join (as far as I have found, I hope there's a way!).
I'm working on a rendering engine which uses winit
for the windows, which has a requirement of having its event loop be on the main thread (due to cross-platform constraints). I've also got another thread that runs the simulation logic (I want it decoupled from rendering, so it can go faster).
I'd like to be able to have some thread that receives and handles (e.g. prints or logs) errors and panics from the threads of the program. I've read that this is usually done in the main thread which spawns the others, which seems very reasonable. In that case you've already got JoinHandle
s, but in my case I don't. Is it possible to create a join handle to the main thread?