print matrix using pthread and singal