Fix comments in thread.cpp

And reshuffle a bit the functions to place
them in a consistent order.

No functional change.