[add] max thread function