Cross-platform lightweight thread class