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

Side by Side Diff: include/utils/SkThreadPool.h

Issue 261673004: eliminate mac xcode 5 only warning (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkThreadPool_DEFINED 8 #ifndef SkThreadPool_DEFINED
9 #define SkThreadPool_DEFINED 9 #define SkThreadPool_DEFINED
10 10
11 #include "SkCondVar.h" 11 #include "SkCondVar.h"
12 #include "SkRunnable.h" 12 #include "SkRunnable.h"
13 #include "SkTDArray.h" 13 #include "SkTDArray.h"
14 #include "SkTInternalLList.h" 14 #include "SkTInternalLList.h"
15 #include "SkThreadUtils.h" 15 #include "SkThreadUtils.h"
16 #include "SkTypes.h" 16 #include "SkTypes.h"
17 17
18 #if defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_ FOR_ANDROID) 18 #if defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_ FOR_ANDROID)
19 # include <unistd.h> 19 # include <unistd.h>
20 #endif 20 #endif
21 21
22 // Returns the number of cores on this machine. 22 // Returns the number of cores on this machine.
23 static inline int num_cores() { 23 static inline int num_cores() {
24 #if defined(SK_BUILD_FOR_WIN32) 24 #if defined(SK_BUILD_FOR_WIN32)
25 SYSTEM_INFO sysinfo; 25 SYSTEM_INFO sysinfo;
26 GetSystemInfo(&sysinfo); 26 GetSystemInfo(&sysinfo);
27 return sysinfo.dwNumberOfProcessors; 27 return sysinfo.dwNumberOfProcessors;
28 #elif defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_MAC) || defined(SK_BUIL D_FOR_ANDROID) 28 #elif defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_MAC) || defined(SK_BUIL D_FOR_ANDROID)
29 return sysconf(_SC_NPROCESSORS_ONLN); 29 return (int) sysconf(_SC_NPROCESSORS_ONLN);
30 #else 30 #else
31 return 1; 31 return 1;
32 #endif 32 #endif
33 } 33 }
34 34
35 template <typename T> 35 template <typename T>
36 class SkTThreadPool { 36 class SkTThreadPool {
37 public: 37 public:
38 /** 38 /**
39 * Create a threadpool with count threads, or one thread per core if kThread PerCore. 39 * Create a threadpool with count threads, or one thread per core if kThread PerCore.
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 pool->fBusyThreads--; 193 pool->fBusyThreads--;
194 pool->fReady.unlock(); 194 pool->fReady.unlock();
195 } 195 }
196 196
197 SkASSERT(false); // Unreachable. The only exit happens when pool->fState is kHalting_State. 197 SkASSERT(false); // Unreachable. The only exit happens when pool->fState is kHalting_State.
198 } 198 }
199 199
200 typedef SkTThreadPool<void> SkThreadPool; 200 typedef SkTThreadPool<void> SkThreadPool;
201 201
202 #endif 202 #endif
OLDNEW
« 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