Added code using auto.
Implemented pthread for C++98.