Big renaming in thread stuff

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>