Despite there being plenty of hot, naked men all around, I have found that popping a hardon in the locker room is surprisingly a non-issue for me. It just doesn't happen.
And it must be a non-issue for most other guys, too. I know there is a good-ish amount of gay/bi guys at any gym, but I can count on one hand the number of real hardons I've seen in a locker room. And in those cases it wasn't even sexy, so much as just weird and awkward. I love to appreciate a nice boner in other contexts, but in the locker room, I just feel weird and look away quickly.
With all that said, it is not at all uncommon for me to sport a firm semi while lifting weights, particularly when benching heavy. But I've noticed many guys get semis while lifting, both gay and straight. No one seems to care. I doubt there's even anything really sexual about it. I'm guessing there's just a surge of testosterone while lifting or something that causes it.