diff options
author | mtklein <mtklein@chromium.org> | 2015-10-20 11:05:06 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-20 11:05:06 -0700 |
commit | a1bde7d2e152188f8d5a2d0f759030ed032a2522 (patch) | |
tree | de7478fb950b474c5fbc41e5c30c1770a834df0c /src/utils/SkThreadUtils_win.cpp | |
parent | 1d3ff434954189e194c468f429598465146dcf4b (diff) |
Remove SkThread::setProcessorAffinity()
It's only used by a couple unit tests. We have other ways of getting
the same quality testing of our ref-count code now (e.g. TSAN).
BUG=skia:
CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Ubuntu-GCC-x86_64-Release-CMake-Trybot,Build-Mac10.9-Clang-x86_64-Release-CMake-Trybot
Review URL: https://codereview.chromium.org/1408213005
Diffstat (limited to 'src/utils/SkThreadUtils_win.cpp')
-rw-r--r-- | src/utils/SkThreadUtils_win.cpp | 40 |
1 files changed, 1 insertions, 39 deletions
diff --git a/src/utils/SkThreadUtils_win.cpp b/src/utils/SkThreadUtils_win.cpp index a5efb939f3..07cceee142 100644 --- a/src/utils/SkThreadUtils_win.cpp +++ b/src/utils/SkThreadUtils_win.cpp @@ -53,7 +53,7 @@ SkThread::SkThread(entryPointProc entryPoint, void* data) { 0, // use default stack size thread_start, // thread function name (proxy) winData, // argument to thread function (proxy args) - CREATE_SUSPENDED, // create suspended so affinity can be set + CREATE_SUSPENDED, // we used to set processor affinity, which needed this &winData->fThreadId); // returns the thread identifier } @@ -96,41 +96,3 @@ void SkThread::join() { WaitForSingleObject(winData->fHandle, INFINITE); } - -static unsigned int num_bits_set(DWORD_PTR mask) { - unsigned int count; - for (count = 0; mask; ++count) { - mask &= mask - 1; - } - return count; -} - -static unsigned int nth_set_bit(unsigned int n, DWORD_PTR mask) { - n %= num_bits_set(mask); - for (unsigned int setBitsSeen = 0, currentBit = 0; true; ++currentBit) { - if (mask & (static_cast<DWORD_PTR>(1) << currentBit)) { - ++setBitsSeen; - if (setBitsSeen > n) { - return currentBit; - } - } - } -} - -bool SkThread::setProcessorAffinity(unsigned int processor) { - SkThread_WinData* winData = static_cast<SkThread_WinData*>(fData); - if (nullptr == winData->fHandle) { - return false; - } - - DWORD_PTR processAffinityMask; - DWORD_PTR systemAffinityMask; - if (0 == GetProcessAffinityMask(GetCurrentProcess(), - &processAffinityMask, - &systemAffinityMask)) { - return false; - } - - DWORD_PTR threadAffinityMask = 1 << nth_set_bit(processor, processAffinityMask); - return 0 != SetThreadAffinityMask(winData->fHandle, threadAffinityMask); -} |