fn join_thread(&mut self, joined_thread_id: ThreadId) -> InterpResult<'tcx> {
        if self.threads[joined_thread_id].join_status != ThreadJoinStatus::Joinable {
            throw_ub_format!("trying to join a detached or already joined thread");
        }
        if joined_thread_id == self.active_thread {
            throw_ub_format!("trying to join itself");
        }
        assert!(
            self.threads
                .iter()
                .all(|thread| thread.state != ThreadState::BlockedOnJoin(joined_thread_id)),
            "a joinable thread already has threads waiting for its termination"
        );
        // Mark the joined thread as being joined so that we detect if other
        // threads try to join it.
        self.threads[joined_thread_id].join_status = ThreadJoinStatus::Joined;
        if self.threads[joined_thread_id].state != ThreadState::Terminated {
            // The joined thread is still running, we need to wait for it.
            self.active_thread_mut().state = ThreadState::BlockedOnJoin(joined_thread_id);
            trace!(
                "{:?} blocked on {:?} when trying to join",
                self.active_thread,
                joined_thread_id
            );
        }
        Ok(())
    }
/// Mark that the active thread tries to join the thread with `joined_thread_id`.
Mark that the active thread tries to join the thread with `joined_thread_id`.
Mark that the active thread tries to join the thread with ` joined_thread_id ` .
fn join_thread(&mut self, joined_thread_id: ThreadId) -> InterpResult<'tcx> {
        if self.threads[joined_thread_id].join_status != ThreadJoinStatus::Joinable {
            throw_ub_format!("trying to join a detached or already joined thread");
        }
        if joined_thread_id == self.active_thread {
            throw_ub_format!("trying to join itself");
        }
        assert!(
            self.threads
                .iter()
                .all(|thread| thread.state != ThreadState::BlockedOnJoin(joined_thread_id)),
            "a joinable thread already has threads waiting for its termination"
        );
        // Mark the joined thread as being joined so that we detect if other
        // threads try to join it.
        self.threads[joined_thread_id].join_status = ThreadJoinStatus::Joined;
        if self.threads[joined_thread_id].state != ThreadState::Terminated {
            // The joined thread is still running, we need to wait for it.
            self.active_thread_mut().state = ThreadState::BlockedOnJoin(joined_thread_id);
            trace!(
                "{:?} blocked on {:?} when trying to join",
                self.active_thread,
                joined_thread_id
            );
        }
        Ok(())
    }
fn join_thread ( & mut self , joined_thread_id : ThreadId ) -> InterpResult < ' tcx > { if self . threads [ joined_thread_id ] . join_status != ThreadJoinStatus :: Joinable { throw_ub_format ! ( " " ) ; } if joined_thread_id == self . active_thread { throw_ub_format ! ( " " ) ; } assert ! ( self threads iter ( ) all ( thread thread state ThreadState BlockedOnJoin ( joined_thread_id ) ) " " ) ; // Mark the joined thread as being joined so that we detect if other // threads try to join it. self . threads [ joined_thread_id ] . join_status = ThreadJoinStatus :: Joined ; if self . threads [ joined_thread_id ] . state != ThreadState :: Terminated { // The joined thread is still running, we need to wait for it. self . active_thread_mut ( ) . state = ThreadState :: BlockedOnJoin ( joined_thread_id ) ; trace ! ( " " self active_thread joined_thread_id ) ; } Ok ( ( ) ) }
Mark that the active thread tries to join the thread with `joined_thread_id`.
Mark that the active thread tries to join the thread with ` joined_thread_id ` .
&mut self
joined_thread_id
ThreadId
&mut self
joined_thread_id
ThreadId