allocate_thread_id
thread_id allocate_thread_id();
id = threadID >= 0 ? threadID : allocate_thread_id();