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

Side by Side Diff: base/threading/platform_thread_linux.cc

Issue 1784623005: Test dynamic priorities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/threading/platform_thread.h" 5 #include "base/threading/platform_thread.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <sched.h> 8 #include <sched.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 30 matching lines...) Expand all
41 41
42 bool SetCurrentThreadPriorityForPlatform(ThreadPriority priority) { 42 bool SetCurrentThreadPriorityForPlatform(ThreadPriority priority) {
43 #if !defined(OS_NACL) 43 #if !defined(OS_NACL)
44 return priority == ThreadPriority::REALTIME_AUDIO && 44 return priority == ThreadPriority::REALTIME_AUDIO &&
45 pthread_setschedparam(pthread_self(), SCHED_RR, &kRealTimePrio) == 0; 45 pthread_setschedparam(pthread_self(), SCHED_RR, &kRealTimePrio) == 0;
46 #else 46 #else
47 return false; 47 return false;
48 #endif 48 #endif
49 } 49 }
50 50
51 bool SetThreadPriority(PlatformThreadId tid, ThreadPriority priority) {
52 LOG(ERROR) << "\nPRAS:: Aaicha gho, ithe ka yetey...";
53 return false;
54 }
55
51 bool GetCurrentThreadPriorityForPlatform(ThreadPriority* priority) { 56 bool GetCurrentThreadPriorityForPlatform(ThreadPriority* priority) {
52 #if !defined(OS_NACL) 57 #if !defined(OS_NACL)
53 int maybe_sched_rr = 0; 58 int maybe_sched_rr = 0;
54 struct sched_param maybe_realtime_prio = {0}; 59 struct sched_param maybe_realtime_prio = {0};
55 if (pthread_getschedparam(pthread_self(), &maybe_sched_rr, 60 if (pthread_getschedparam(pthread_self(), &maybe_sched_rr,
56 &maybe_realtime_prio) == 0 && 61 &maybe_realtime_prio) == 0 &&
57 maybe_sched_rr == SCHED_RR && 62 maybe_sched_rr == SCHED_RR &&
58 maybe_realtime_prio.sched_priority == kRealTimePrio.sched_priority) { 63 maybe_realtime_prio.sched_priority == kRealTimePrio.sched_priority) {
59 *priority = ThreadPriority::REALTIME_AUDIO; 64 *priority = ThreadPriority::REALTIME_AUDIO;
60 return true; 65 return true;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 #if !defined(THREAD_SANITIZER) 103 #if !defined(THREAD_SANITIZER)
99 return 0; 104 return 0;
100 #else 105 #else
101 // ThreadSanitizer bloats the stack heavily. Evidence has been that the 106 // ThreadSanitizer bloats the stack heavily. Evidence has been that the
102 // default stack size isn't enough for some browser tests. 107 // default stack size isn't enough for some browser tests.
103 return 2 * (1 << 23); // 2 times 8192K (the default stack size on Linux). 108 return 2 * (1 << 23); // 2 times 8192K (the default stack size on Linux).
104 #endif 109 #endif
105 } 110 }
106 111
107 } // namespace base 112 } // namespace base
OLDNEW
« no previous file with comments | « base/threading/platform_thread_internal_posix.h ('k') | base/threading/platform_thread_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698