Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

make annotations API threadsafe - #1069

Merged
kkaefer merged 1 commit into
masterfrom
1069-annotations-threadsafe
Mar 27, 2015
Merged

kkaefer merged 1 commit into
masterfrom
1069-annotations-threadsafe

Conversation

@kkaefer

@kkaefer kkaefer commented Mar 26, 2015

Copy link
Copy Markdown
Member

Continuation of #1022, which became solid general improvements that were worth merging. Going to figure out a threading strategy here.

/cc @kkaefer

@incanus

incanus commented Mar 23, 2015

Copy link
Copy Markdown
Contributor Author

The calls to updateAnnotationTiles()here:

std::vector<uint32_t> Map::addPointAnnotations(std::vector<LatLng> points, std::vector<std::string>& symbols) {
assert(Environment::currentlyOn(ThreadType::Main));
auto result = annotationManager->addPointAnnotations(points, symbols, *this);
updateAnnotationTiles(result.first);
return result.second;
}
void Map::removeAnnotation(uint32_t annotation) {
assert(Environment::currentlyOn(ThreadType::Main));
removeAnnotations({ annotation });
}
void Map::removeAnnotations(std::vector<uint32_t> annotations) {
assert(Environment::currentlyOn(ThreadType::Main));
auto result = annotationManager->removeAnnotations(annotations);
updateAnnotationTiles(result);
}

Don't need to be synchronous. Both Map::addPointAnnotations() and Map::removeAnnotations() can return their results; the tile invalidation is merely a visual refresh that can come shortly afterwards. Can we simply safely set a copy of the tiles to the map thread, and AnnotationManager::getTile() (called by LiveTileData::parse()) can just grab a const tile post-refresh?

@1ec5

1ec5 commented Mar 26, 2015

Copy link
Copy Markdown
Contributor

See also 10a30da#commitcomment-10408334.

@incanus

incanus commented Mar 26, 2015

Copy link
Copy Markdown
Contributor Author

Preview work in 1069-annotations-threadsafe looks 👍 to me.

calls that return a value block until the operation was executed
@kkaefer
kkaefer force-pushed the 1069-annotations-threadsafe branch from a9743ca to a262939 Compare March 27, 2015 11:56
kkaefer added a commit that referenced this pull request Mar 27, 2015
@kkaefer
kkaefer merged commit 64b60fa into master Mar 27, 2015
@kkaefer
kkaefer deleted the 1069-annotations-threadsafe branch March 27, 2015 12:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants