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

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

Issue 9141005: Change the thread interface in runtime/platform and use it starting all threads (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments from asiva@ Created 8 years, 10 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 <pthread.h>
6
7 #include "bin/thread_pool.h"
8
9 void ThreadPool::Start() {
10 pthread_t* threads
11 = reinterpret_cast<pthread_t*>(calloc(size_, sizeof(pthread_t*))); // NOL INT
12 data_.set_threads(threads);
13 for (int i = 0; i < size_; i++) {
14 pthread_t handler_thread;
15 int result = pthread_create(&handler_thread,
16 NULL,
17 &ThreadPool::Main,
18 this);
19 if (result != 0) {
20 FATAL("Create and start thread pool thread");
21 }
22 data_.threads()[i] = handler_thread;
23 }
24 }
25
26
27 void ThreadPool::Shutdown() {
28 terminate_ = true;
29 queue_.Shutdown();
30 for (int i = 0; i < size_; i++) {
31 pthread_join(data_.threads()[i], NULL);
32 }
33 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698