MCPcopy Create free account
hub / github.com/CyanogenMod/android_frameworks_base / schedule

Method schedule

tools/aapt/WorkQueue.cpp:38–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38status_t WorkQueue::schedule(WorkUnit* workUnit, size_t backlog) {
39 AutoMutex _l(mLock);
40
41 if (mFinished || mCanceled) {
42 return INVALID_OPERATION;
43 }
44
45 if (mWorkThreads.size() < mMaxThreads
46 && mIdleThreads < mWorkUnits.size() + 1) {
47 sp<WorkThread> workThread = new WorkThread(this, mCanCallJava);
48 status_t status = workThread->run("WorkQueue::WorkThread");
49 if (status) {
50 return status;
51 }
52 mWorkThreads.add(workThread);
53 mIdleThreads += 1;
54 } else if (backlog) {
55 while (mWorkUnits.size() >= mMaxThreads * backlog) {
56 mWorkDequeuedCondition.wait(mLock);
57 if (mFinished || mCanceled) {
58 return INVALID_OPERATION;
59 }
60 }
61 }
62
63 mWorkUnits.add(workUnit);
64 mWorkChangedCondition.broadcast();
65 return OK;
66}
67
68status_t WorkQueue::cancel() {
69 AutoMutex _l(mLock);

Callers 6

preProcessImagesFunction · 0.80
scheduleFilterWakeMethod · 0.80
setTimerMethod · 0.80
mainMethod · 0.80
detectCountryMethod · 0.80

Calls 5

broadcastMethod · 0.80
sizeMethod · 0.65
runMethod · 0.65
addMethod · 0.65
waitMethod · 0.45

Tested by

no test coverage detected