本文整理汇总了C++中scopedLocker函数的典型用法代码示例。如果您正苦于以下问题:C++ scopedLocker函数的具体用法?C++ scopedLocker怎么用?C++ scopedLocker使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scopedLocker函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scopedLocker
void OsmAnd::MapMarker_P::setPosition(const PointI position)
{
QWriteLocker scopedLocker(&_lock);
_position = position;
_hasUnappliedChanges = true;
}
示例2: scopedLocker
std::shared_ptr<OsmAnd::MapMarker> OsmAnd::MapMarkerBuilder_P::buildAndAddToCollection(
const std::shared_ptr<MapMarkersCollection>& collection)
{
QReadLocker scopedLocker(&_lock);
// Construct map symbols group for this marker
const std::shared_ptr<MapMarker> marker(new MapMarker(
_baseOrder,
_pinIcon,
_pinIconAlignment,
detachedOf(_onMapSurfaceIcons),
_isAccuracyCircleSupported,
_accuracyCircleBaseColor));
marker->setIsHidden(_isHidden);
if (_isAccuracyCircleSupported)
{
marker->setIsAccuracyCircleVisible(_isAccuracyCircleVisible);
marker->setAccuracyCircleRadius(_accuracyCircleRadius);
}
marker->setPosition(_position);
marker->setPinIconModulationColor(_pinIconModulationColor);
marker->applyChanges();
// Add marker to collection and return it if adding was successful
if (!collection->_p->addMarker(marker))
return nullptr;
return marker;
}
示例3: scopedLocker
bool OsmAnd::ObfsCollection_P::remove(const ObfsCollection::SourceOriginId entryId)
{
QWriteLocker scopedLocker(&_sourcesOriginsLock);
const auto itSourceOrigin = _sourcesOrigins.find(entryId);
if (itSourceOrigin == _sourcesOrigins.end())
return false;
const auto& sourceOrigin = *itSourceOrigin;
if (sourceOrigin->type == SourceOriginType::Directory)
{
const auto& directoryAsSourceOrigin = std::static_pointer_cast<const DirectoryAsSourceOrigin>(sourceOrigin);
for(const auto watchedSubdirectory : constOf(directoryAsSourceOrigin->watchedSubdirectories))
_fileSystemWatcher->removePath(watchedSubdirectory);
_fileSystemWatcher->removePath(directoryAsSourceOrigin->directory.canonicalPath());
}
else if (sourceOrigin->type == SourceOriginType::File)
{
const auto& fileAsSourceOrigin = std::static_pointer_cast<const FileAsSourceOrigin>(sourceOrigin);
_fileSystemWatcher->removePath(fileAsSourceOrigin->fileInfo.canonicalFilePath());
}
_sourcesOrigins.erase(itSourceOrigin);
invalidateCollectedSources();
return true;
}
示例4: collectSources
std::shared_ptr<OsmAnd::ObfDataInterface> OsmAnd::ObfsCollection_P::obtainDataInterface() const
{
// Check if sources were invalidated
if (_collectedSourcesInvalidated.loadAcquire() > 0)
collectSources();
// Create ObfReaders from collected sources
QList< std::shared_ptr<const ObfReader> > obfReaders;
{
QReadLocker scopedLocker(&_collectedSourcesLock);
for(const auto& collectedSources : constOf(_collectedSources))
{
obfReaders.reserve(obfReaders.size() + collectedSources.size());
for(const auto& obfFile : constOf(collectedSources))
{
std::shared_ptr<const ObfReader> obfReader(new ObfReader(obfFile));
if (!obfReader->isOpened() || !obfReader->obtainInfo())
continue;
obfReaders.push_back(qMove(obfReader));
}
}
}
return std::shared_ptr<ObfDataInterface>(new ObfDataInterface(obfReaders));
}
示例5: scopedLocker
void OsmAnd::Concurrent::Dispatcher::shutdown()
{
QMutexLocker scopedLocker(&_performedShutdownConditionMutex);
shutdownAsync();
REPEAT_UNTIL(_performedShutdown.wait(&_performedShutdownConditionMutex));
}
示例6: scopedLocker
QString OsmAnd::MapSymbolIntersectionClassesRegistry_P::getClassNameById(const ClassId classId) const
{
QReadLocker scopedLocker(&_lock);
if (_nameById.size() <= classId)
return QString::null;
return _nameById[classId];
}
示例7: scopedLocker
void OsmAnd::OnlineMapRasterTileProvider_P::unlockTile( const TileId tileId, const ZoomLevel zoom )
{
QMutexLocker scopedLocker(&_tilesInProcessMutex);
_tilesInProcess[zoom].remove(tileId);
_waitUntilAnyTileIsProcessed.wakeAll();
}
示例8: scopedLocker
void OsmAnd::MapMarkerBuilder_P::addOnMapSurfaceIcon(
const MapMarker::OnSurfaceIconKey key,
const std::shared_ptr<const SkBitmap>& bitmap)
{
QWriteLocker scopedLocker(&_lock);
_onMapSurfaceIcons.insert(key, bitmap);
}
示例9: scopedLocker
void OsmAnd::FavoriteLocationsCollection_P::clearFavoriteLocations()
{
QWriteLocker scopedLocker(&_collectionLock);
doClearFavoriteLocations();
notifyCollectionChanged();
}
示例10: scopedLocker
void OsmAnd::ObfFile_P::unlockFromWriting() const
{
QMutexLocker scopedLocker(&_lockCounterMutex);
assert(_lockCounter < 0);
_lockCounter++;
_lockCounterWaitCondition.wakeAll();
}
示例11: scopedLocker
unsigned int OsmAnd::BaseSearchEngine_P::removeAllDataSources()
{
QWriteLocker scopedLocker(&_dataSourcesLock);
const auto removedCount = _dataSources.size();
_dataSources.clear();
return removedCount;
}
示例12: scopedLocker
void OsmAnd::TextRasterizer_P::clearFontsCache()
{
QMutexLocker scopedLocker(&_fontTypefacesCacheMutex);
for (const auto& typeface : _fontTypefacesCache)
typeface->unref();
_fontTypefacesCache.clear();
}
示例13: scopedLocker
void OsmAnd::OnlineRasterMapLayerProvider::setLocalCachePath(
const QString& localCachePath,
const bool appendPathSuffix /*= true*/)
{
QMutexLocker scopedLocker(&_p->_localCachePathMutex);
_p->_localCachePath = appendPathSuffix
? QDir(localCachePath).absoluteFilePath(pathSuffix)
: localCachePath;
}
示例14: scopedLocker
std::shared_ptr<const OsmAnd::MapStyle> OsmAnd::MapStylesCollection_P::getAsIsStyle(const QString& name) const
{
QReadLocker scopedLocker(&_stylesLock);
const auto citStyle = _styles.constFind(name);
if (citStyle == _styles.cend())
return nullptr;
return *citStyle;
}
示例15: scopedLocker
OsmAnd::MapRasterizer_P::~MapRasterizer_P()
{
{
QMutexLocker scopedLocker(&_pathEffectsMutex);
for (auto& pathEffect : _pathEffects)
pathEffect->unref();
}
}