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

Side by Side Diff: base/worker_pool_linux.cc

Issue 339059: Add compiler-specific "examine printf format" attributes to printfs. (Closed)
Patch Set: cleanups Created 11 years, 1 month 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/worker_pool.h" 5 #include "base/worker_pool.h"
6 #include "base/worker_pool_linux.h" 6 #include "base/worker_pool_linux.h"
7 7
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/platform_thread.h" 10 #include "base/platform_thread.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 private: 60 private:
61 const std::string name_prefix_; 61 const std::string name_prefix_;
62 const int idle_seconds_before_exit_; 62 const int idle_seconds_before_exit_;
63 scoped_refptr<base::LinuxDynamicThreadPool> pool_; 63 scoped_refptr<base::LinuxDynamicThreadPool> pool_;
64 64
65 DISALLOW_COPY_AND_ASSIGN(WorkerThread); 65 DISALLOW_COPY_AND_ASSIGN(WorkerThread);
66 }; 66 };
67 67
68 void WorkerThread::ThreadMain() { 68 void WorkerThread::ThreadMain() {
69 const std::string name = 69 const std::string name =
70 StringPrintf("%s/%d", name_prefix_.c_str(), 70 StringPrintf("%s/%d", name_prefix_.c_str(), PlatformThread::CurrentId());
71 IntToString(PlatformThread::CurrentId()).c_str());
72 PlatformThread::SetName(name.c_str()); 71 PlatformThread::SetName(name.c_str());
73 72
74 for (;;) { 73 for (;;) {
75 Task* task = pool_->WaitForTask(); 74 Task* task = pool_->WaitForTask();
76 if (!task) 75 if (!task)
77 break; 76 break;
78 task->Run(); 77 task->Run();
79 delete task; 78 delete task;
80 } 79 }
81 80
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 return NULL; 159 return NULL;
161 } 160 }
162 } 161 }
163 162
164 Task* task = tasks_.front(); 163 Task* task = tasks_.front();
165 tasks_.pop(); 164 tasks_.pop();
166 return task; 165 return task;
167 } 166 }
168 167
169 } // namespace base 168 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698