Quantcast
Viewing all articles
Browse latest Browse all 1557

Photon Server and Multithreading

Hello,

I posted this question on Photon Server's official forum but right now only myself and 1 guest is currently viewing the board so I figured I'd ask the question here too. Here is a link if you'd prefer to answer it there exitgames.com/viewtopic.php?f=5&t=4043, Here is the question: I have a question on PhotonServer's PeerBase class and multithreading. Is it safe to start a short-lifetime thread that will access the send event and disconnect methods of the PeerBase without a lock or am I required to use the lock below. What sort of issues will I run into for the short duration of the lock and is it possible I could deadlock with something under the hood? Any information on how I should go about starting this thread would be great. I don't want to halt execution by Sleeping on the main thread. The reason I'm sleeping though is if I don't sleep it seems to disconnect me before my client can receive the event. This may be because I stop polling the listener for events after disconnection; I don't really want to rewrite that client side. So is there any other way to handle this, is this code below the recommended or do I not need to lock at all?

Please help

I didn't find the right solution from the internet.

References:
https://forum.unity.com/threads/photon-server-and-multithreading.221837/
Animated explainer video production service

Thank you


Viewing all articles
Browse latest Browse all 1557

Trending Articles