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

Unified Diff: runtime/bin/thread_pool_macos.h

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, 12 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 side-by-side diff with in-line comments
Download patch
Index: runtime/bin/thread_pool_macos.h
diff --git a/runtime/bin/thread_pool_macos.h b/runtime/bin/thread_pool_macos.h
new file mode 100644
index 0000000000000000000000000000000000000000..89548fd93fbc404423f1237db12647cf45c5a137
--- /dev/null
+++ b/runtime/bin/thread_pool_macos.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#ifndef BIN_THREAD_POOL_MACOS_H_
+#define BIN_THREAD_POOL_MACOS_H_
+
+#include <pthread.h>
+
+#include "vm/globals.h"
+
+
+class TaskQueueData {
+ private:
+ TaskQueueData() {}
+ ~TaskQueueData() {}
+
+ pthread_mutex_t* mutex() { return &mutex_; }
+ pthread_cond_t* cond() { return &cond_; }
+
+ pthread_mutex_t mutex_;
+ pthread_cond_t cond_;
+
+ friend class TaskQueue;
+
+ DISALLOW_ALLOCATION();
+ DISALLOW_COPY_AND_ASSIGN(TaskQueueData);
+};
+
+
+class ThreadPoolData {
+ private:
+ static const int kMaxThreadPoolSize = 16;
Mads Ager (google) 2012/01/04 14:32:46 You could set this in the constructor to Platform:
Søren Gjesse 2012/01/04 15:15:07 Removed the constant alltogether. threads_ is now
+
+ ThreadPoolData() {}
+ ~ThreadPoolData() {}
+
+ pthread_t* threads() { return threads_; }
+
+ pthread_t threads_[kMaxThreadPoolSize];
+
+ friend class ThreadPool;
+
+ DISALLOW_ALLOCATION();
+ DISALLOW_COPY_AND_ASSIGN(ThreadPoolData);
+};
+
+#endif // BIN_THREAD_POOL_MACOS_H_

Powered by Google App Engine
This is Rietveld 408576698