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

Commit 5da5ef82 authored by Shunkai Yao's avatar Shunkai Yao Committed by Gerrit Code Review
Browse files

Merge "Add -Wthread-safety in libmediautils"

parents 2f0061e2 656497dd
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ cc_library {
        "-Wall",
        "-Wextra",
        "-Werror",
        "-Wthread-safety",
    ],

    header_libs: [
+2 −0
Original line number Diff line number Diff line
@@ -292,6 +292,7 @@ TimerThread::MonitorThread::~MonitorThread() {

void TimerThread::MonitorThread::threadFunc() {
    std::unique_lock _l(mMutex);
    ::android::base::ScopedLockAssertion lock_assertion(mMutex);
    while (!mShouldExit) {
        Handle nextDeadline = INVALID_HANDLE;
        Handle now = INVALID_HANDLE;
@@ -385,6 +386,7 @@ TimerThread::Handle TimerThread::MonitorThread::add(
std::shared_ptr<const TimerThread::Request> TimerThread::MonitorThread::remove(Handle handle) {
    std::pair<std::shared_ptr<const Request>, TimerCallback> data;
    std::unique_lock ul(mMutex);
    ::android::base::ScopedLockAssertion lock_assertion(mMutex);
    if (const auto it = mMonitorRequests.find(handle);
        it != mMonitorRequests.end()) {
        data = std::move(it->second);
+1 −1
Original line number Diff line number Diff line
@@ -297,7 +297,7 @@ class TimerThread {
                std::pair<std::shared_ptr<const Request>, TimerCallback>>
                        mSecondChanceRequests GUARDED_BY(mMutex);

        RequestQueue& mTimeoutQueue; // locked internally, added to when request times out.
        RequestQueue& mTimeoutQueue GUARDED_BY(mMutex); // added to when request times out.

        // Worker thread variables
        bool mShouldExit GUARDED_BY(mMutex) = false;