Added the GetCurrentThread function.