Changeset 2773 for code/trunk/src/network/packet/Packet.cc
- Timestamp:
- Mar 11, 2009, 4:06:31 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/network/packet/Packet.cc
r2756 r2773 31 31 32 32 #include <cassert> 33 #ifndef WIN32_LEAN_AND_MEAN34 # define WIN32_LEAN_AND_MEAN35 #endif36 #define NOMINMAX // required to stop windows.h screwing up std::min definition37 33 #include <enet/enet.h> 38 34 #include <boost/bind.hpp> 35 #include <boost/thread/recursive_mutex.hpp> 39 36 40 37 #include "network/ConnectionManager.h" … … 58 55 59 56 std::map<size_t, Packet *> Packet::packetMap_; 60 boost::recursive_mutex Packet::packetMap_mutex; 57 //! Static mutex for any packetMap_ access 58 static boost::recursive_mutex packetMap_mutex_g; 61 59 62 60 Packet::Packet(){ … … 142 140 // Assures we don't create a packet and destroy it right after in another thread 143 141 // without having a reference in the packetMap_ 144 boost::recursive_mutex::scoped_lock lock( Packet::packetMap_mutex);142 boost::recursive_mutex::scoped_lock lock(packetMap_mutex_g); 145 143 packetMap_[(size_t)(void*)enetPacket_] = this; 146 144 } … … 217 215 */ 218 216 void Packet::deletePacket(ENetPacket *enetPacket){ 219 boost::recursive_mutex::scoped_lock lock( Packet::packetMap_mutex);217 boost::recursive_mutex::scoped_lock lock(packetMap_mutex_g); 220 218 // Get our Packet from a gloabal map with all Packets created in the send() method of Packet. 221 219 std::map<size_t, Packet*>::iterator it = packetMap_.find((size_t)enetPacket);
Note: See TracChangeset
for help on using the changeset viewer.