We now make sure the thread starts up and sets its id. There was a race condition where a process could create a thread and immediately try to join it. If the thread had not initialized itself the join would fail with EINVAL as we passed -1 as its id.