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

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

Issue 2888043009: fuchsia: Implement platform thread functions (Closed)
Patch Set: rebase Created 3 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 | « base/BUILD.gn ('k') | 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/threading/platform_thread.h"
6
7 #include <pthread.h>
8 #include <sched.h>
9
10 #include "base/threading/platform_thread_internal_posix.h"
11
12 namespace base {
13
14 namespace internal {
15
16 const ThreadPriorityToNiceValuePair kThreadPriorityToNiceValueMap[4] = {
17 {ThreadPriority::BACKGROUND, 10},
18 {ThreadPriority::NORMAL, 0},
19 {ThreadPriority::DISPLAY, -8},
20 {ThreadPriority::REALTIME_AUDIO, -10},
21 };
22
23 bool SetCurrentThreadPriorityForPlatform(ThreadPriority priority) {
24 sched_param prio = {0};
25 prio.sched_priority = ThreadPriorityToNiceValue(priority);
26 return pthread_setschedparam(pthread_self(), SCHED_OTHER, &prio) == 0;
27 }
28
29 bool GetCurrentThreadPriorityForPlatform(ThreadPriority* priority) {
30 sched_param prio = {0};
31 int policy;
32 if (pthread_getschedparam(pthread_self(), &policy, &prio) != 0) {
33 return false;
34 }
35 *priority = NiceValueToThreadPriority(prio.sched_priority);
36 return true;
37 }
38
39 } // namespace internal
40
41 void InitThreading() {}
42
43 void TerminateOnThread() {}
44
45 size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
46 return 0;
47 }
48
49 // static
50 void PlatformThread::SetName(const std::string& name) {
51 // TODO(fuchsia): There's no available API at the moment to set the thread
52 // name. See https://crbug.com/725726.
53 }
54
55 } // namespace base
OLDNEW
« no previous file with comments | « base/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698