Locking thread until joined now, preventing multiple joins and race conditions.