Merge "Fix thread join hangs"