get_thread_num function

Get the number of threads