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

Commit 3eddecc3 authored by Christopher Tate's avatar Christopher Tate
Browse files

Build JobStatus objects outside the lock

Constructing a JobStatus can be a surprisingly heavy operation, potentially
involving IPC; so do so outside the primary lock when possible in order to
reduce lock contention.

Bug 28946245

Change-Id: I51fffa6d29d566647edb583ae6e46ed6038d36e3
parent 15818e11
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -223,10 +223,11 @@ public class JobServiceContext extends IJobCallback.Stub implements ServiceConne
     * stop executing.
     */
    JobStatus getRunningJob() {
        final JobStatus job;
        synchronized (mLock) {
            return mRunningJob == null ?
                    null : new JobStatus(mRunningJob);
            job = mRunningJob;
        }
        return job == null ? null : new JobStatus(job);
    }

    /** Called externally when a job that was scheduled for execution should be cancelled. */