Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 43b2abf7 authored by Daniel Zheng's avatar Daniel Zheng
Browse files

libsnapshot: set num merge threads

Read number of merge threads from build. In the case that this isn't
specified, fallback to our default.

**THIS doesn't seem to be currently working. It looks like we can't
directly read the property here?

Test: th
Change-Id: I115b6b987699759168d34239d030cfcd0238b1b4
parent 09e081f9
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@

#include <android-base/logging.h>

#include "android-base/properties.h"
#include "merge_worker.h"
#include "read_worker.h"
#include "snapuserd_core.h"
@@ -235,8 +236,10 @@ void SnapshotHandlerManager::MonitorMerge() {

        LOG(INFO) << "MonitorMerge: active-merge-threads: " << active_merge_threads_;
        {
            auto num_merge_threads = android::base::GetUintProperty<uint>(
                    "ro.virtual_ab.num_merge_threads", kMaxMergeThreads);
            std::lock_guard<std::mutex> lock(lock_);
            while (active_merge_threads_ < kMaxMergeThreads && merge_handlers_.size() > 0) {
            while (active_merge_threads_ < num_merge_threads && merge_handlers_.size() > 0) {
                auto handler = merge_handlers_.front();
                merge_handlers_.pop();

+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ namespace android {
namespace snapshot {

static constexpr uint32_t kMaxPacketSize = 512;
static constexpr uint8_t kMaxMergeThreads = 2;

static constexpr char kBootSnapshotsWithoutSlotSwitch[] =
        "/metadata/ota/snapshot-boot-without-slot-switch";