C++11

Reference #1401.

Change much stuff to use new library.
Oh, yes, there seems to be a bug, the constructor is supposed to assign current thread's ID to the pointed value. I see now how the code as it is wouldn't make sense to you.