Pthread method for Assignment 2