Implement GetThreadCount on Linux, fix warnings.
Fix test.