CxxUtils: Fix coverity warnings.
- Use move instead of copy (CID 11722, 12215, 14969, 13035)
- Check for error return from sysconf. (CID 12405, 11081)
- Check return values (CID 10122, 10405)
- Uninitialized struct field (CID 10095, 10351)
- Using lock objects as temporaries seems to confuse coverity, making it miss seeing the release of the mutex. Change to avoid using temporaries. (CID 12513, 12854, 13396, 14033)
- Avoid allocating large objects on the stack (CID 10209)
- Missing lock in test (CID 12617, 11127)