Added some multi thread codes.