History

Gonna access that vector from two threads? Need to lock it.

Andrzej Kapolka committed 13 years ago

Commit 48bee0e1 parent 015ff4a2 files · +5 −1Browse files

Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all

Unified · Split

interface/src/Application.cpp+4−0
@@ -4045,11 +4045,13 @@ void* Application::processVoxels(void* args) { · 4044 unmodified lines
40454045 app->_wantToKillLocalVoxels = false;
40464046 }
40474047
4048+ app->_voxelPacketMutex.lock();
40484049 while (app->_voxelPackets.size() > 0) {
40494050 NetworkPacket& packet = app->_voxelPackets.front();
40504051 app->processVoxelPacket(packet.getSenderAddress(), packet.getData(), packet.getLength());
40514052 app->_voxelPackets.erase(app->_voxelPackets.begin());
40524053 }
4054+ app->_voxelPacketMutex.unlock();
40534055
40544056 if (!app->_enableProcessVoxelsThread) {
40554057 break;
@@ -4063,7 +4065,9 @@ void* Application::processVoxels(void* args) { · 7 unmodified lines
40634065 }
40644066
40654067 void Application::queueVoxelPacket(sockaddr& senderAddress, unsigned char* packetData, ssize_t packetLength) {
4068+ _voxelPacketMutex.lock();
40664069 _voxelPackets.push_back(NetworkPacket(senderAddress, packetData, packetLength));
4070+ _voxelPacketMutex.unlock();
40674071 }
40684072
40694073 void Application::processVoxelPacket(sockaddr& senderAddress, unsigned char* packetData, ssize_t packetLength) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t