Fix return code which is an error occurred at pthread function

The processing which is referring to the errno variable as a processing result of a pthread function was corrected.