[PD-dev] Improving portability of the thread management