Exemplo n.º 1
0
}

TEST_F(Storage, AssetStress) {
    SCOPED_TEST(AssetStress)

    using namespace mbgl;

    util::RunLoop loop;

    mbgl::DefaultFileSource fs(nullptr, getFileSourceRoot());

    unsigned numThreads = 50;

    auto callback = [&] {
        if (!--numThreads) {
            loop.stop();
        }
    };

    std::vector<std::unique_ptr<util::Thread<TestWorker>>> threads;
    std::vector<std::unique_ptr<mbgl::WorkRequest>> requests;
    util::ThreadContext context = { "Test", util::ThreadType::Map, util::ThreadPriority::Regular };

    for (unsigned i = 0; i < numThreads; ++i) {
        std::unique_ptr<util::Thread<TestWorker>> thread =
            std::make_unique<util::Thread<TestWorker>>(context, &fs);

        requests.push_back(
            thread->invokeWithCallback(&TestWorker::run, callback));

        threads.push_back(std::move(thread));
 void end() {
     loop.stop();
 }