Passing arguments to the thread function