It depends on what your thoughts were at the moment. And, if you are gay, there is nothing with it -- that's your life, your perogative.
I, personally, never had a hard-on in a public shower or gym. But, if it were a female public gym, that would all change.