C++11

Reference #1401.

Change much stuff to use new library.
But there's no better way to get the ID's value, I'd say this is enough. We just need to tell the threads apart.