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

Commit 6d5e9dfd authored by Paul Lawrence's avatar Paul Lawrence Committed by Automerger Merge Worker
Browse files

Revert "Fix deadlock caused by two-threaded property controls" am: 3196be61 am: abc6e124

parents 4eff384d abc6e124
Loading
Loading
Loading
Loading
+23 −27
Original line number Original line Diff line number Diff line
@@ -117,6 +117,7 @@ static bool accept_messages = false;
static std::mutex accept_messages_lock;
static std::mutex accept_messages_lock;
static std::thread property_service_thread;
static std::thread property_service_thread;
static std::thread property_service_for_system_thread;
static std::thread property_service_for_system_thread;
static std::mutex set_property_lock;


static std::unique_ptr<PersistWriteThread> persist_write_thread;
static std::unique_ptr<PersistWriteThread> persist_write_thread;


@@ -394,11 +395,7 @@ static std::optional<uint32_t> PropertySet(const std::string& name, const std::s
        return {PROP_ERROR_INVALID_VALUE};
        return {PROP_ERROR_INVALID_VALUE};
    }
    }


    if (name == "sys.powerctl") {
    auto lock = std::lock_guard{set_property_lock};
        // No action here - NotifyPropertyChange will trigger the appropriate action, and since this
        // can come to the second thread, we mustn't call out to the __system_property_* functions
        // which support multiple readers but only one mutator.
    } else {
    prop_info* pi = (prop_info*)__system_property_find(name.c_str());
    prop_info* pi = (prop_info*)__system_property_find(name.c_str());
    if (pi != nullptr) {
    if (pi != nullptr) {
        // ro.* properties are actually "write-once".
        // ro.* properties are actually "write-once".
@@ -425,7 +422,6 @@ static std::optional<uint32_t> PropertySet(const std::string& name, const std::s
        }
        }
        WritePersistentProperty(name, value);
        WritePersistentProperty(name, value);
    }
    }
    }


    NotifyPropertyChange(name, value);
    NotifyPropertyChange(name, value);
    return {PROP_SUCCESS};
    return {PROP_SUCCESS};