Thanks. And I suppose in the case of a more complex program it couldn't be guaranteed that the thread ID hasn't been reused by another thread elsewhere in the program after the first one has exited.
So I think a better approach for the check_disk program would be to pass in a pointer to a struct that includes a marker that the child thread can set when it's finished, and check that from the main thread, does that make sense?