Merge pull request #2711 from ZappoMan/quiet_logs

quite the error messages about failed locks
This commit is contained in:
Clément Brisset 2014-04-22 11:51:20 -07:00
commit f64988f73d

View file

@ -938,6 +938,8 @@ void VoxelSystem::copyWrittenDataSegmentToReadArrays(glBufferIndex segmentStart,
}
void VoxelSystem::copyWrittenDataToReadArrays(bool fullVBOs) {
static unsigned int lockForReadAttempt = 0;
static unsigned int lockForWriteAttempt = 0;
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
"copyWrittenDataToReadArrays()");
@ -946,7 +948,9 @@ void VoxelSystem::copyWrittenDataToReadArrays(bool fullVBOs) {
// time around, the only side effect is the VBOs won't be updated this frame
const int WAIT_FOR_LOCK_IN_MS = 5;
if (_readArraysLock.tryLockForWrite(WAIT_FOR_LOCK_IN_MS)) {
lockForWriteAttempt = 0;
if (_writeArraysLock.tryLockForRead(WAIT_FOR_LOCK_IN_MS)) {
lockForReadAttempt = 0;
if (_voxelsDirty && _voxelsUpdated) {
if (fullVBOs) {
copyWrittenDataToReadArraysFullVBOs();
@ -956,11 +960,19 @@ void VoxelSystem::copyWrittenDataToReadArrays(bool fullVBOs) {
}
_writeArraysLock.unlock();
} else {
qDebug() << "couldn't get _writeArraysLock.LockForRead()...";
lockForReadAttempt++;
// only report error of first failure
if (lockForReadAttempt == 1) {
qDebug() << "couldn't get _writeArraysLock.LockForRead()...";
}
}
_readArraysLock.unlock();
} else {
qDebug() << "couldn't get _readArraysLock.LockForWrite()...";
lockForWriteAttempt++;
// only report error of first failure
if (lockForWriteAttempt == 1) {
qDebug() << "couldn't get _readArraysLock.LockForWrite()...";
}
}
}