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

[core] Make the BackgroundScheduler a singleton - #13935

Merged
tmpsantos merged 2 commits into
masterfrom
tmpsantos-thread_pool
May 10, 2019
Merged

tmpsantos merged 2 commits into
masterfrom
tmpsantos-thread_pool

Conversation

@tmpsantos

@tmpsantos tmpsantos commented Feb 15, 2019 •

Copy link
Copy Markdown
Contributor
  • Do not carry it over everywhere as parameter, it is a shared
    instance anyway and the lifecycle is pretty much the app lifecycle
    from the moment we instantiate a map.
  • Rename to BackgroundScheduler because it is a Scheduler that will
    do tasks in the background, we don't make assumptions if it is a
    thread pool or a single thread.
  • Most importantly, remove the dependency from core on platform.

@tmpsantos
tmpsantos requested a review from 1ec5 as a code owner February 15, 2019 14:28
@tmpsantos
tmpsantos requested a review from a team February 15, 2019 14:28
@tmpsantos
tmpsantos force-pushed the tmpsantos-thread_pool branch from 4c12d6b to c19934d Compare February 15, 2019 14:29
@tmpsantos
tmpsantos requested a review from pozdnyakov February 15, 2019 14:30

@julianrex julianrex left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have concerns about using platform::GetBackgroundScheduler() directly, rather than being injected? Seems that it more tightly couples those classes.

Could this also affect the tests? We've got a similar thing on iOS where parallel tests are affecting each other due to a shared singleton (and I'm trying to remove the dependency on the singleton in that instance!)

Comment thread platform/node/src/node_thread_pool.cpp Resolved
@pozdnyakov

Copy link
Copy Markdown
Contributor

Do you have concerns about using platform::GetBackgroundScheduler() directly, rather than being injected? Seems that it more tightly couples those classes.

True, however IMO background worker is generic enough to be considered as a part of the project "foundation classes" :)

@tmpsantos tmpsantos self-assigned this Feb 22, 2019
@tmpsantos
tmpsantos force-pushed the tmpsantos-thread_pool branch 2 times, most recently from b2d93c9 to 31dd705 Compare February 25, 2019 14:33
@tmpsantos
tmpsantos force-pushed the tmpsantos-thread_pool branch 5 times, most recently from 657bd0e to c3e201c Compare March 11, 2019 22:07
@tmpsantos
tmpsantos force-pushed the tmpsantos-thread_pool branch from c3e201c to 3011269 Compare March 12, 2019 14:29
@tmpsantos
tmpsantos force-pushed the tmpsantos-thread_pool branch 5 times, most recently from 1490fb0 to dc4195e Compare April 11, 2019 12:09
@tmpsantos
tmpsantos force-pushed the tmpsantos-thread_pool branch 7 times, most recently from 444276d to 480de64 Compare May 3, 2019 13:57
@tmpsantos
tmpsantos force-pushed the tmpsantos-thread_pool branch from 480de64 to 02b821d Compare May 7, 2019 17:12
@tmpsantos
tmpsantos force-pushed the tmpsantos-thread_pool branch 2 times, most recently from d7b108c to 4403058 Compare May 8, 2019 10:29
Comment thread src/mbgl/actor/scheduler.cpp Resolved
Comment thread include/mbgl/actor/actor.hpp Resolved
Comment thread include/mbgl/actor/scheduler.hpp Resolved
Comment thread src/mbgl/actor/scheduler.cpp Resolved
@tmpsantos
tmpsantos force-pushed the tmpsantos-thread_pool branch 3 times, most recently from 06718e8 to 1f35089 Compare May 9, 2019 13:05

@alexshalamov alexshalamov left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove benchmark/fixtures/api/cache.db from the PR, maybe add it to .gitignore?
Also, need to be synchronized with #14620, whichever lands first.

Comment thread include/mbgl/actor/scheduler.hpp Resolved
tmpsantos added 2 commits May 10, 2019 11:26
- Do not carry it over everywhere as parameter, it is a shared
  instance anyway and the lifecycle is pretty much the app lifecycle
  from the moment we instantiate a map.
- Rename to BackgroundScheduler because it is a Scheduler that will
  do tasks in the background, we don't make assumptions if it is a
  thread pool or a single thread.
- Most importantly, remove the dependency from `core` on `platform`.
Simplify, use the default thread pool, less platform abstraction.
@tmpsantos
tmpsantos force-pushed the tmpsantos-thread_pool branch from 1f35089 to 5c355fd Compare May 10, 2019 08:26
@tmpsantos
tmpsantos merged commit cf08f64 into master May 10, 2019
@tmpsantos
tmpsantos deleted the tmpsantos-thread_pool branch May 10, 2019 11:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants