> X-Virus-Scanned: by XS4ALL Virus Scanner
> Date: Wed, 7 Oct 2015 12:47:35 +0100
> From: Stuart Henderson <st...@openbsd.org>
> 
> 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?

Yes, properly protected by a mutex and perhaps using a condition
variable.

Cheers,

Mark

Reply via email to