History

Remove vm_thread reference from exec/fork vm functions.

arr committed 9 years ago

Commit a64d7751 parent 98ad0165 files · +30 −23Browse files

Showing the changes to src/vm/scheduler.cpp (1 of 5 files). Show all

Unified · Split

src/vm/scheduler.cpp+2−6
@@ -139,7 +139,7 @@ vm_scheduler_control_t &default_scheduler_t::get_controller() const · 138 unmodified lines
139 return const_cast<default_scheduler_t&>(*this);139 return const_cast<default_scheduler_t&>(*this);
140}140}
141 141
142const vm_thread_t& default_scheduler_t::schedule_thread(std::unique_ptr<vm_thread_t> thread)142void default_scheduler_t::schedule_thread(std::unique_ptr<vm_thread_t> thread)
143{143{
144 assert(thread != nullptr);144 assert(thread != nullptr);
145 if (thread->get_registers().current_thread_state != vm_thread_state_t::ready)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 const auto new_thread_id = thread->get_thread_id();160 const auto new_thread_id = thread->get_thread_id();
161 assert(_all_vm_threads.find(new_thread_id) == _all_vm_threads.cend());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 // Allocate a new container and set the thread entry163 // 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 _runnable_vm_thread_ids.push_back(new_thread_id);166 _runnable_vm_thread_ids.push_back(new_thread_id);
169 167
170 // Notify the worker a thread has been enqueued.168 // Notify the worker a thread has been enqueued.
171 lock.unlock();169 lock.unlock();
172 _worker_event.notify_one();170 _worker_event.notify_one();
173
174 return *(new_thread->vm_thread);
175}171}
176 172
177void default_scheduler_t::set_tool_dispatch_on_all_threads(vm_tool_dispatch_t *dispatch)173void default_scheduler_t::set_tool_dispatch_on_all_threads(vm_tool_dispatch_t *dispatch)