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

Side by Side Diff: runtime/bin/thread_pool.cc

Issue 8983017: Start of thread pool implementation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix compilation on Windows Created 8 years, 11 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 #include "bin/thread_pool.h"
6
7 void ThreadPool::Shutdown() {
8 UNIMPLEMENTED();
9 }
10
11
12 void ThreadPool::InsertTask(Task task) {
13 TaskQueueEntry* entry = new TaskQueueEntry(task);
14 queue.Insert(entry);
15 }
16
17
18 Task ThreadPool::WaitForTask() {
19 TaskQueueEntry* entry = queue.Remove();
20 if (entry == NULL) {
21 return -1;
22 }
23 Task task = entry->task();
24 delete entry;
25 return task;
26 }
27
28
29 void* ThreadPool::Main(void* args) {
30 printf("Thread pool thread started\n");
Mads Ager (google) 2012/01/04 14:32:46 Should we remove this printing or add a --trace-th
Søren Gjesse 2012/01/04 15:15:07 Added flag --trace_thread_pool.
31 ThreadPool* pool = reinterpret_cast<ThreadPool*>(args);
32 while (true) {
33 printf("Waiting for task\n");
34 Task task = pool->WaitForTask();
35 printf("Got task %d\n", task);
36 }
37 return NULL;
38 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698