| OLD | NEW |
| 1 // Copyright (c) 2014, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dartino 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #include "src/vm/scheduler.h" | 5 #include "src/vm/scheduler.h" |
| 6 | 6 |
| 7 #include "src/shared/flags.h" | 7 #include "src/shared/flags.h" |
| 8 | 8 |
| 9 #include "src/vm/frame.h" | 9 #include "src/vm/frame.h" |
| 10 #include "src/vm/gc_thread.h" | 10 #include "src/vm/gc_thread.h" |
| 11 #include "src/vm/interpreter.h" | 11 #include "src/vm/interpreter.h" |
| 12 #include "src/vm/links.h" | 12 #include "src/vm/links.h" |
| 13 #include "src/vm/port.h" | 13 #include "src/vm/port.h" |
| 14 #include "src/vm/process.h" | 14 #include "src/vm/process.h" |
| 15 #include "src/vm/process_queue.h" | 15 #include "src/vm/process_queue.h" |
| 16 #include "src/vm/session.h" | 16 #include "src/vm/session.h" |
| 17 #include "src/vm/thread.h" | 17 #include "src/vm/thread.h" |
| 18 | 18 |
| 19 #define HANDLE_BY_SESSION_OR_SELF(session_expression, self_expression) \ | 19 #define HANDLE_BY_SESSION_OR_SELF(session_expression, self_expression) \ |
| 20 do { \ | 20 do { \ |
| 21 Session* session = process->program()->session(); \ | 21 Session* session = process->program()->session(); \ |
| 22 if (session == NULL || !session->is_debugging() || \ | 22 if (session == NULL || !session->is_debugging() || \ |
| 23 !(session_expression)) { \ | 23 !(session_expression)) { \ |
| 24 self_expression; \ | 24 self_expression; \ |
| 25 } \ | 25 } \ |
| 26 } while (false); | 26 } while (false); |
| 27 | 27 |
| 28 namespace fletch { | 28 namespace dartino { |
| 29 | 29 |
| 30 // Global instance of scheduler. | 30 // Global instance of scheduler. |
| 31 Scheduler* Scheduler::scheduler_ = NULL; | 31 Scheduler* Scheduler::scheduler_ = NULL; |
| 32 | 32 |
| 33 ThreadState::ThreadState() | 33 ThreadState::ThreadState() |
| 34 : idle_monitor_(Platform::CreateMonitor()) {} | 34 : idle_monitor_(Platform::CreateMonitor()) {} |
| 35 | 35 |
| 36 void ThreadState::AttachToCurrentThread() { thread_ = ThreadIdentifier(); } | 36 void ThreadState::AttachToCurrentThread() { thread_ = ThreadIdentifier(); } |
| 37 | 37 |
| 38 ThreadState::~ThreadState() { | 38 ThreadState::~ThreadState() { |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 if (runner->programs_[i] == program) { | 739 if (runner->programs_[i] == program) { |
| 740 runner->exitcodes_[i] = exitcode; | 740 runner->exitcodes_[i] = exitcode; |
| 741 runner->remaining_--; | 741 runner->remaining_--; |
| 742 runner->monitor_->NotifyAll(); | 742 runner->monitor_->NotifyAll(); |
| 743 return; | 743 return; |
| 744 } | 744 } |
| 745 } | 745 } |
| 746 UNREACHABLE(); | 746 UNREACHABLE(); |
| 747 } | 747 } |
| 748 | 748 |
| 749 } // namespace fletch | 749 } // namespace dartino |
| OLD | NEW |