Fix compiler error due to missing pthread header (Issue #2953)