Hello, I am working on a tank game and am trying to use both TCP and UDP. So far the TCP is working however I am having difficulties getting UDP to work do to some confusion about mutex. Is it safe to use
sf::Lock before calling receive on a
blocking UDP socket, or will this stall the program?
sf::Packet* uPack = new sf::Packet();
sf::IpAddress rcvAddr;
short unsigned int rcvPort;
PacketCont* packCont = new PacketCont();
sf::Lock lock(sManager->mutex);//this is the line I am worried about
sf::Socket::Status status = m_UDPSocket.receive(*uPack, rcvAddr, rcvPort);
Note: I need the mutex since I am using multiple threads which access the
UDP socket class.