| 147 |  | * If the FLAG_JOIN_DONE is set, the J thread arrived first and is blocked : the K thread reset the  BLOCKED_JOIN bit in the J thread (using the extended pointer stored in the ''join_xp'' field), reset the JOIN_DONE flag, releases the ''join_lock'' in T thread, and completes the T thread destruction as described in the detached case and return. | 
                        | 148 |  | * If the FLAG_JOIN_DONE is not set, the K thread arrived first: the K thread set the BLOCKED_JOIN bit in the K thread, set the FLAG_KILL_DONE in the T thread, register its extended pointer in the T thread ''join_xp'' field, releases the ''join_lock'' in the T thread, and deschedules. It will complete the T thread destruction as described in the detached case and return when it resume. | 
                        | 149 |  | * The J thread test the FLAG_KILL_DONE in the T thread descriptor: s | 
                        | 150 |  | * If the FLAG_KILL_DONE is set, the K thread arrived first and is blocked : the J thread reset the BLOCKED_JOIN bit in the K thread, get the exit value from the T thread "join_value" field, releases the "join_lock" in T thread, and return. | 
                      
                        |  | 147 | * If the FLAG_JOIN_DONE is set, the J thread arrived first and is blocked on the BLOCKED_JOIN condition: the K thread unblock the J thread from the BLOCKED_JOIN condition (using the ''join_xp'' field in the T thread), reset the JOIN_DONE flag in T thread, releases the ''join_lock'' in T thread, and completes the T thread destruction as described in the detached case. | 
                        |  | 148 | * If the FLAG_JOIN_DONE is not set, the K thread arrived first: the K thread blocks the K thread on the BLOCKED_JOIN condition, set the FLAG_KILL_DONE in the T thread, register the killer thread extended pointer in the T thread ''join_xp'' field, releases the ''join_lock'' in the T thread, and deschedules. It completes the T thread destruction as described in the detached case when it resumes. | 
                        |  | 149 | * The J thread test the FLAG_KILL_DONE in the T thread descriptor: | 
                        |  | 150 | * If the FLAG_KILL_DONE is set, the K thread arrived first and is blocked on the BLOCKED_JOIN condition: the J thread reset the BLOCKED_JOIN bit in the K thread, get the exit value from the T thread "join_value" field, releases the "join_lock" in T thread, and return. |