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

Commit 46873730 authored by Jason Sams's avatar Jason Sams Committed by Android (Google) Code Review
Browse files

Merge "Query the CPU count and use the result to determine if and how many worker threads we use."

parents fed1722e 7f4d0c97
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -468,8 +468,11 @@ Context::Context(Device *dev, bool isGraphics, bool useDepth)
    timerInit();
    timerSet(RS_TIMER_INTERNAL);

    LOGV("RS Launching thread(s)");
    mWorkers.mCount = 2;
    int cpu = sysconf(_SC_NPROCESSORS_ONLN);
    LOGV("RS Launching thread(s), reported CPU count %i", cpu);
    if (cpu < 2) cpu = 0;

    mWorkers.mCount = (uint32_t)cpu;
    mWorkers.mThreadId = (pthread_t *) calloc(mWorkers.mCount, sizeof(pthread_t));
    mWorkers.mNativeThreadId = (pid_t *) calloc(mWorkers.mCount, sizeof(pid_t));
    mWorkers.mLaunchSignals = new Signal[mWorkers.mCount];