Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Unified Diff: src/utils/SkThreadUtils_pthread_linux.cpp

Issue 1408213005: Remove SkThread::setProcessorAffinity() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: gAdds Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/utils/SkThreadUtils.h ('k') | src/utils/SkThreadUtils_pthread_mach.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkThreadUtils_pthread_linux.cpp
diff --git a/src/utils/SkThreadUtils_pthread_linux.cpp b/src/utils/SkThreadUtils_pthread_linux.cpp
deleted file mode 100644
index 4a03cb8276d9144142aeaae4ecfb52e5d1aa32dd..0000000000000000000000000000000000000000
--- a/src/utils/SkThreadUtils_pthread_linux.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE //for pthread_setaffinity_np
-#endif
-
-#include "SkThreadUtils.h"
-#include "SkThreadUtils_pthread.h"
-
-#include <pthread.h>
-
-static int nth_set_cpu(unsigned int n, cpu_set_t* cpuSet) {
- n %= CPU_COUNT(cpuSet);
- for (unsigned int setCpusSeen = 0, currentCpu = 0; true; ++currentCpu) {
- if (CPU_ISSET(currentCpu, cpuSet)) {
- ++setCpusSeen;
- if (setCpusSeen > n) {
- return currentCpu;
- }
- }
- }
-}
-
-bool SkThread::setProcessorAffinity(unsigned int processor) {
- SkThread_PThreadData* pthreadData = static_cast<SkThread_PThreadData*>(fData);
- if (!pthreadData->fValidPThread) {
- return false;
- }
-
- cpu_set_t parentCpuset;
- if (0 != pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &parentCpuset)) {
- return false;
- }
-
- cpu_set_t cpuset;
- CPU_ZERO(&cpuset);
- CPU_SET(nth_set_cpu(processor, &parentCpuset), &cpuset);
- return 0 == pthread_setaffinity_np(pthreadData->fPThread,
- sizeof(cpu_set_t),
- &cpuset);
-}
« no previous file with comments | « src/utils/SkThreadUtils.h ('k') | src/utils/SkThreadUtils_pthread_mach.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698