check return value for pthreads
add rvalue overload for C++11