OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include <errno.h> | 5 #include <errno.h> |
6 #include <poll.h> | 6 #include <poll.h> |
7 #include <pthread.h> | 7 #include <pthread.h> |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <string.h> | 9 #include <string.h> |
10 #include <sys/time.h> | 10 #include <sys/time.h> |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 | 363 |
364 void EventHandlerImplementation::StartEventHandler() { | 364 void EventHandlerImplementation::StartEventHandler() { |
365 pthread_t handler_thread; | 365 pthread_t handler_thread; |
366 int result = pthread_create(&handler_thread, | 366 int result = pthread_create(&handler_thread, |
367 NULL, | 367 NULL, |
368 &EventHandlerImplementation::Poll, | 368 &EventHandlerImplementation::Poll, |
369 this); | 369 this); |
370 if (result != 0) { | 370 if (result != 0) { |
371 FATAL("Create start event handler thread"); | 371 FATAL("Create start event handler thread"); |
372 } | 372 } |
373 | |
374 if (Dart_IsVMFlagSet("enable_thread_pool")) { | |
375 thread_pool.Start(); | |
376 for (int i = 0; i < 100; i++) { | |
377 thread_pool.InsertTask(i); | |
378 } | |
379 } | |
380 } | 373 } |
381 | 374 |
382 | 375 |
383 void EventHandlerImplementation::SendData(intptr_t id, | 376 void EventHandlerImplementation::SendData(intptr_t id, |
384 Dart_Port dart_port, | 377 Dart_Port dart_port, |
385 intptr_t data) { | 378 intptr_t data) { |
386 WakeupHandler(id, dart_port, data); | 379 WakeupHandler(id, dart_port, data); |
387 } | 380 } |
OLD | NEW |