I added a TCP connection to an external server, to my CActor class. Later, I want the actor object to receive some update information through this connection. But when I exit the game mode, it still receive broadcast packet from the server. Well, I put the receiving function on a detached thread. It receive and read packets inside a loop which take a bool parameter isKeepRecv to continue running. isKeepRecv is set to true on CActor::init(). The problem is when should I change isKeepRecv to false so the thread can end itself? I want to change it on exit game mode event, but I don't know whether the enum code for such event even exists. Then I tried to change the isKeepRecv to false in ~CActor destructor but it doesn't change anything. When I put a breakpoint in the destructor, no break happens. It seems that the destructor itself has never been called. It would be great also if someone can explain to me the flow diagram of cryengine. I am getting a hard time trying to break it down and understand it.
Thank you

PS: English is not my first language, so forgive me if you get difficulties understanding my post
