How is FallbackSendAckThread thread-safe?

Options
Hello, I have a question that's probably very basic about PUN.

PhotonHandler maintains a background thread that ACKs every 100 ms. I can't figure out how it is thread-safe though. The FallbackSendAckThread thread accesses all kinds of data like PhotonNetwork.BackgroundTimeout, timerToStopConnectionInBackground, etc. - but that data doesn't have any kind of locking around it. So how does PUN know for sure in that background thread that it's not accessing data that is in the middle of being written by the main thread?

Thanks for the information.

Comments

  • gibsnson
    Options
    I ask because I'm considering adding a bit of additional logic to that thread to check an additional flag to decide whether or not it should shut down, but I'm concerned that that will not be thread-safe.