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 "vm/thread_pool.h" | 5 #include "vm/thread_pool.h" |
6 | 6 |
7 #include "vm/dart.h" | 7 #include "vm/dart.h" |
8 #include "vm/flags.h" | 8 #include "vm/flags.h" |
9 #include "vm/lockers.h" | 9 #include "vm/lockers.h" |
10 | 10 |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 | 426 |
427 // static | 427 // static |
428 void ThreadPool::Worker::Main(uword args) { | 428 void ThreadPool::Worker::Main(uword args) { |
429 Worker* worker = reinterpret_cast<Worker*>(args); | 429 Worker* worker = reinterpret_cast<Worker*>(args); |
430 OSThread* os_thread = OSThread::Current(); | 430 OSThread* os_thread = OSThread::Current(); |
431 ASSERT(os_thread != NULL); | 431 ASSERT(os_thread != NULL); |
432 ThreadId id = os_thread->id(); | 432 ThreadId id = os_thread->id(); |
433 ThreadJoinId join_id = os_thread->join_id(); | 433 ThreadJoinId join_id = os_thread->join_id(); |
434 ThreadPool* pool; | 434 ThreadPool* pool; |
435 | 435 |
| 436 // Set the thread's stack_base based on the current stack pointer. |
| 437 os_thread->set_stack_base(Thread::GetCurrentStackPointer()); |
| 438 |
436 { | 439 { |
437 MonitorLocker ml(&worker->monitor_); | 440 MonitorLocker ml(&worker->monitor_); |
438 ASSERT(worker->task_); | 441 ASSERT(worker->task_); |
439 worker->id_ = id; | 442 worker->id_ = id; |
440 pool = worker->pool_; | 443 pool = worker->pool_; |
441 } | 444 } |
442 | 445 |
443 bool released = worker->Loop(); | 446 bool released = worker->Loop(); |
444 | 447 |
445 // It should be okay to access these unlocked here in this assert. | 448 // It should be okay to access these unlocked here in this assert. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 } | 486 } |
484 | 487 |
485 // Call the thread exit hook here to notify the embedder that the | 488 // Call the thread exit hook here to notify the embedder that the |
486 // thread pool thread is exiting. | 489 // thread pool thread is exiting. |
487 if (Dart::thread_exit_callback() != NULL) { | 490 if (Dart::thread_exit_callback() != NULL) { |
488 (*Dart::thread_exit_callback())(); | 491 (*Dart::thread_exit_callback())(); |
489 } | 492 } |
490 } | 493 } |
491 | 494 |
492 } // namespace dart | 495 } // namespace dart |
OLD | NEW |