posix: Refactored pthread code to make things less error-prone
posix: Refactored pthread code to make things less error-prone

diacritic/BoxFort,Snaipe/BoxFort,diacritic/BoxFort,diacritic/BoxFort,Snaipe/BoxFort,Snaipe/BoxFort,Snaipe/BoxFort,diacritic/BoxFort