Building pthread class