adding new code to threadMasterThread and working now cmake