Question about race condition of room's custom property
I want to check all players are successfully loaded when scene changed. So I use room custom property.
If a client has loaded a scene, he/she do something like this :
int count = (int)PhotonNetwork.CurrentRoom.CustomProperty["playerCount"];
PhotonNetwork.CurrentRoom.SetCustomProperty("playerCount", count+1);
I want to know that is there any race condition while call 'SetCustomProperty' and sending messages about updated value to other players?
I have already read this document's race condition section. But i'm not sure that it says there's no race condition in a scenario like above
Best Answer
-
Hi @presentlee,
Thank you for choosing Photon!
That documentation link you posted is about Photon Server product (self-hosted SDK) and not about PUN. While you can use PUN with self-hosted Photon Server, what you are looking for is not threading but instead CAS: Check-And-Swap or Compare-And-Set feature.
Read more here.
1
Answers
-
Hi @presentlee,
Thank you for choosing Photon!
That documentation link you posted is about Photon Server product (self-hosted SDK) and not about PUN. While you can use PUN with self-hosted Photon Server, what you are looking for is not threading but instead CAS: Check-And-Swap or Compare-And-Set feature.
Read more here.
1 -
Thank you for your help!
1