Threads: Remove a redundant function.

Use the next_thread_id variable directly.