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

Unified Diff: runtime/bin/eventhandler.h

Issue 9112013: Thread pool changes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added tread pool shutdown 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/builtin_sources.gypi ('k') | runtime/bin/eventhandler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/eventhandler.h
diff --git a/runtime/bin/eventhandler.h b/runtime/bin/eventhandler.h
index a2ecaafc58733a45fe739dcb105f56d6c9568bb2..39200847165964dcaf5881ce64e4c578f4985b67 100644
--- a/runtime/bin/eventhandler.h
+++ b/runtime/bin/eventhandler.h
@@ -6,6 +6,7 @@
#define BIN_EVENTHANDLER_H_
#include "bin/builtin.h"
+#include "bin/thread_pool.h"
// Flags used to provide information and actions to the eventhandler
// when sending a message about a file descriptor. These flags should
@@ -41,6 +42,29 @@ class EventHandler {
delegate_.SendData(id, dart_port, data);
}
+ static void* AsyncTaskHandler(void* args) {
+ if (Dart_IsVMFlagSet("trace_thread_pool")) {
+ printf("Got async task\n");
+ }
+ return NULL;
+ }
+
+ static void Initialize() {
+ if (Dart_IsVMFlagSet("enable_thread_pool")) {
+ ASSERT(thread_pool_ == NULL);
+ thread_pool_ = new ThreadPool(&EventHandler::AsyncTaskHandler);
+ thread_pool_->Start();
+ }
+ }
+
+ static void Terminate() {
+ if (Dart_IsVMFlagSet("enable_thread_pool")) {
+ if (thread_pool_ != NULL) {
+ thread_pool_->Shutdown();
+ }
+ }
+ }
+
static EventHandler* StartEventHandler() {
EventHandler* handler = new EventHandler();
handler->delegate_.StartEventHandler();
@@ -49,6 +73,7 @@ class EventHandler {
private:
EventHandlerImplementation delegate_;
+ static ThreadPool* thread_pool_;
};
« no previous file with comments | « runtime/bin/builtin_sources.gypi ('k') | runtime/bin/eventhandler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698