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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
440 | 440 |
441 // static | 441 // static |
442 void ThreadPool::Worker::Main(uword args) { | 442 void ThreadPool::Worker::Main(uword args) { |
443 Worker* worker = reinterpret_cast<Worker*>(args); | 443 Worker* worker = reinterpret_cast<Worker*>(args); |
444 OSThread* os_thread = OSThread::Current(); | 444 OSThread* os_thread = OSThread::Current(); |
445 ASSERT(os_thread != NULL); | 445 ASSERT(os_thread != NULL); |
446 ThreadId id = os_thread->id(); | 446 ThreadId id = os_thread->id(); |
447 ThreadPool* pool; | 447 ThreadPool* pool; |
448 | 448 |
449 // Set the thread's stack_base based on the current stack pointer. | 449 // Set the thread's stack_base based on the current stack pointer. |
450 os_thread->set_stack_base(Thread::GetCurrentStackPointer()); | 450 uword current_sp = Thread::GetCurrentStackPointer(); |
451 if (current_sp > os_thread->stack_base()) { | |
452 os_thread->set_stack_base(current_sp); | |
453 } | |
siva
2017/04/13 01:50:18
Which situation causes the code inside the 'if' st
| |
451 | 454 |
452 { | 455 { |
453 MonitorLocker ml(&worker->monitor_); | 456 MonitorLocker ml(&worker->monitor_); |
454 ASSERT(worker->task_); | 457 ASSERT(worker->task_); |
455 worker->id_ = id; | 458 worker->id_ = id; |
456 pool = worker->pool_; | 459 pool = worker->pool_; |
457 } | 460 } |
458 | 461 |
459 bool released = worker->Loop(); | 462 bool released = worker->Loop(); |
460 | 463 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
500 } | 503 } |
501 | 504 |
502 // Call the thread exit hook here to notify the embedder that the | 505 // Call the thread exit hook here to notify the embedder that the |
503 // thread pool thread is exiting. | 506 // thread pool thread is exiting. |
504 if (Dart::thread_exit_callback() != NULL) { | 507 if (Dart::thread_exit_callback() != NULL) { |
505 (*Dart::thread_exit_callback())(); | 508 (*Dart::thread_exit_callback())(); |
506 } | 509 } |
507 } | 510 } |
508 | 511 |
509 } // namespace dart | 512 } // namespace dart |
OLD | NEW |