Showing the changes to src/vm/scheduler.cpp (1 of 5 files). Show all
Unified · Split
| @@ -139,7 +139,7 @@ vm_scheduler_control_t &default_scheduler_t::get_controller() const · 138 unmodified lines | ||
| 139 | 139 | return const_cast<default_scheduler_t&>(*this); |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | −const vm_thread_t& default_scheduler_t::schedule_thread(std::unique_ptr<vm_thread_t> thread) | |
| 142 | +void default_scheduler_t::schedule_thread(std::unique_ptr<vm_thread_t> thread) | |
| 143 | 143 | { |
| 144 | 144 | assert(thread != nullptr); |
| 145 | 145 | if (thread->get_registers().current_thread_state != vm_thread_state_t::ready) |
| @@ -160,18 +160,14 @@ const vm_thread_t& default_scheduler_t::schedule_thread(std::unique_ptr<vm_threa · 14 unmodified lines | ||
| 160 | 160 | const auto new_thread_id = thread->get_thread_id(); |
| 161 | 161 | assert(_all_vm_threads.find(new_thread_id) == _all_vm_threads.cend()); |
| 162 | 162 | |
| 163 | − auto new_thread = std::make_shared<thread_instance_t>(std::move(thread)); | |
| 164 | − | |
| 165 | 163 | // Allocate a new container and set the thread entry |
| 166 | − _all_vm_threads[new_thread_id] = new_thread; | |
| 164 | + _all_vm_threads[new_thread_id] = std::make_shared<thread_instance_t>(std::move(thread)); | |
| 167 | 165 | |
| 168 | 166 | _runnable_vm_thread_ids.push_back(new_thread_id); |
| 169 | 167 | |
| 170 | 168 | // Notify the worker a thread has been enqueued. |
| 171 | 169 | lock.unlock(); |
| 172 | 170 | _worker_event.notify_one(); |
| 173 | − | |
| 174 | − return *(new_thread->vm_thread); | |
| 175 | 171 | } |
| 176 | 172 | |
| 177 | 173 | void default_scheduler_t::set_tool_dispatch_on_all_threads(vm_tool_dispatch_t *dispatch) |