C++11

Reference #1401.

Change much stuff to use new library.
I couldn't see what the original code did as the Thread ID passed was always zero.