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

Unified Diff: src/utils/SkThreadUtils_pthread_linux.cpp

Issue 22259005: Use stub where pthread_setaffinity_np() isn't available. define cpu_set_t to cpuset_t on Free/NetB… Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 4 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 | « no previous file | no next file » | 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
index 4a03cb8276d9144142aeaae4ecfb52e5d1aa32dd..769595d4ced9ea70b6ad5e33a07fb04329766fdc 100644
--- a/src/utils/SkThreadUtils_pthread_linux.cpp
+++ b/src/utils/SkThreadUtils_pthread_linux.cpp
@@ -13,6 +13,25 @@
#include "SkThreadUtils_pthread.h"
#include <pthread.h>
+#ifdef __FreeBSD__
+#include <pthread_np.h>
+#endif
+
+#if defined(__FreeBSD__) || defined(__NetBSD__)
+#define cpu_set_t cpuset_t
bungeman-skia 2013/08/06 20:44:12 isn't this what typedef is for?
+#endif
+
+#ifndef CPU_COUNT
+static int CPU_COUNT(cpu_set_t *set) {
+ int count = 0;
+ for (int i = 0; i < CPU_SETSIZE; i++) {
+ if (CPU_ISSET(i, set)) {
+ count++;
+ }
+ }
+ return count;
+}
+#endif /* !CPU_COUNT */
static int nth_set_cpu(unsigned int n, cpu_set_t* cpuSet) {
n %= CPU_COUNT(cpuSet);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698